diff options
-rw-r--r-- | drivers/staging/android/lowmemorykiller.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 39d5e6502b21..37ed0f8c432c 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -71,10 +71,10 @@ static int task_notify_func(struct notifier_block *self, unsigned long val, void *data) { struct task_struct *task = data; - if (task == lowmem_deathpending) { + + if (task == lowmem_deathpending) lowmem_deathpending = NULL; - task_free_unregister(&task_nb); - } + return NOTIFY_OK; } @@ -168,7 +168,6 @@ static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask) selected->pid, selected->comm, selected_oom_adj, selected_tasksize); lowmem_deathpending = selected; - task_free_register(&task_nb); force_sig(SIGKILL, selected); rem -= selected_tasksize; } @@ -185,6 +184,7 @@ static struct shrinker lowmem_shrinker = { static int __init lowmem_init(void) { + task_free_register(&task_nb); register_shrinker(&lowmem_shrinker); return 0; } @@ -192,6 +192,7 @@ static int __init lowmem_init(void) static void __exit lowmem_exit(void) { unregister_shrinker(&lowmem_shrinker); + task_free_unregister(&task_nb); } module_param_named(cost, lowmem_shrinker.seeks, int, S_IRUGO | S_IWUSR); |