lowmemorykiller: don't unregister notifier from atomic context
authorRabin Vincent <rabin.vincent@stericsson.com>
Thu, 9 Sep 2010 05:18:21 +0000 (10:48 +0530)
committerColin Cross <ccross@android.com>
Tue, 14 Jun 2011 16:09:40 +0000 (09:09 -0700)
commit00b0a66a031ee7024cd0aa7e69a26c6731d1b0fe
treebbf76efba6071967c7c7a2b8fc60d9296577e23c
parentdbc38c633f4b7abe97c53036df55fbb2040188bc
lowmemorykiller: don't unregister notifier from atomic context

The lowmemorykiller registers an atomic notifier for notfication of when
the task is freed.  From this atomic notifier callback, it removes the
atomic notifier via task_free_unregister().  This is incorrect because
atomic_notifier_chain_unregister() calls syncronize_rcu(), which can
sleep, which shouldn't be done from an atomic notifier.

Fix this by registering the notifier during init, and only unregister it
if the lowmemorykiller is unloaded.

Change-Id: I1577b04e617bc2b2e39dcb490fcfc9ce660eb7ec
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
drivers/staging/android/lowmemorykiller.c