staging: android/lowmemorykiller: Don't unregister notifier from atomic context
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 7 Mar 2012 13:54:00 +0000 (17:54 +0400)
committerGrazvydas Ignotas <notasas@gmail.com>
Wed, 25 Apr 2012 22:24:50 +0000 (01:24 +0300)
commitbb968f3d5d6879b0089b704f0190524a53c6df15
tree89f91ae5137fc17f47e80132f1ff69d0fc7ea95f
parent0b738f37686805b9ee95d6463959d427078bc092
staging: android/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.

Rebased to -next by Paul E. McKenney.
Rebased to -next again by Anton Vorontsov.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Christian Bejram <christian.bejram@stericsson.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/lowmemorykiller.c