summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorRebecca Schultz Zavin <rebecca@android.com>2010-08-27 14:44:21 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2010-10-13 14:17:52 -0700
commit2105e072fb2bebc0a1a690a46419de7820f33e1a (patch)
tree400692faf3c0d4016e23593dbb7eb8ad046173a1 /drivers/staging
parent541d45cb18bb9a02f9ce70ce7848cec7b7ce2424 (diff)
Revert "staging: android: lowmemorykiller: Fix task_struct leak"
This reverts commit 8e46542d2f8dc730d4fc1b9cd3df0fe9fc236ed1.
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/android/lowmemorykiller.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c
index 57da5f4613b3..1ab3fe1f3ce7 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -34,6 +34,7 @@
#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;
@@ -73,7 +74,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_free_unregister(&task_nb);
+ task_handoff_unregister(&task_nb);
}
return NOTIFY_OK;
}
@@ -98,6 +99,8 @@ static int lowmem_shrink(struct shrinker *s, int nr_to_scan, gfp_t gfp_mask)
* 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;
@@ -173,8 +176,15 @@ static int lowmem_shrink(struct shrinker *s, int nr_to_scan, gfp_t gfp_mask)
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_free_register(&task_nb);
+ task_handoff_register(&task_nb);
+#endif
force_sig(SIGKILL, selected);
rem -= selected_tasksize;
}