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)
committerRebecca Schultz Zavin <rebecca@android.com>
Tue, 21 Dec 2010 19:47:25 +0000 (11:47 -0800)
commit5545554aac04918ece318270d63cbfcb015577a9
tree40ec1df06d80936332c5733f797228baa45d2f23
parent3671bf769f66e538d490880664a2e2799c4fc3c7
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