diff options
author | San Mehat <san@google.com> | 2010-05-06 15:40:07 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2012-02-14 11:30:24 -0800 |
commit | af0240f095a704f75f032bbcc01f670c65c163ba (patch) | |
tree | 4ef33b57e0ba66c60c6ae13c29224191b2617716 /drivers | |
parent | f7983488cb4c691cb58e9d4c81bdc64af3c6c857 (diff) |
staging: android: lowmemorykiller: Fix task_struct leak
As it turns out, the CONFIG_PROFILING interfaces leak a
task struct if the notifier chain returns NOTIFY_OK.. doh.
This patch reworks lowmemkiller to use the new generic task
free notifier chain.
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/android/lowmemorykiller.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index f4960dd3b26..cae9212d909 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -34,7 +34,6 @@ #include <linux/mm.h> #include <linux/oom.h> #include <linux/sched.h> -#include <linux/profile.h> #include <linux/notifier.h> static uint32_t lowmem_debug_level = 2; @@ -74,7 +73,7 @@ task_notify_func(struct notifier_block *self, unsigned long val, void *data) struct task_struct *task = data; if (task == lowmem_deathpending) { lowmem_deathpending = NULL; - task_handoff_unregister(&task_nb); + task_free_unregister(&task_nb); } return NOTIFY_OK; } @@ -100,8 +99,6 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) * that we have nothing further to offer on * this pass. * - * Note: Currently you need CONFIG_PROFILING - * for this to work correctly. */ if (lowmem_deathpending) return 0; @@ -177,15 +174,8 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n", selected->pid, selected->comm, selected_oom_adj, selected_tasksize); - /* - * If CONFIG_PROFILING is off, then task_handoff_register() - * is a nop. In that case we don't want to stall the killer - * by setting lowmem_deathpending. - */ -#ifdef CONFIG_PROFILING lowmem_deathpending = selected; - task_handoff_register(&task_nb); -#endif + task_free_register(&task_nb); force_sig(SIGKILL, selected); rem -= selected_tasksize; } |