From 591bd82635738ef9c2f16b1716cc21eb41995631 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Mon, 7 Sep 2009 10:14:42 +0100 Subject: [PATCH] --- yaml --- r: 157419 b: refs/heads/master c: 179a8100e12d0053f4b368ea3358dd9a0fc6cb94 h: refs/heads/master i: 157417: e22541ba69b4a2b1f5ea458a1fc7b5155f22c868 157415: 8bc9db7241885040e74e16fa8083f4303f1fc182 v: v3 --- [refs] | 2 +- trunk/mm/kmemleak.c | 22 +++++----------------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/[refs] b/[refs] index 694ea04c13ac..ccdd256ca2e6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 43ed5d6ee0f9bfd655d6bc3cb2d964b80c4422c0 +refs/heads/master: 179a8100e12d0053f4b368ea3358dd9a0fc6cb94 diff --git a/trunk/mm/kmemleak.c b/trunk/mm/kmemleak.c index 74d4089d7588..1563de456441 100644 --- a/trunk/mm/kmemleak.c +++ b/trunk/mm/kmemleak.c @@ -92,6 +92,7 @@ #include #include #include +#include #include #include @@ -1499,7 +1500,7 @@ static const struct file_operations kmemleak_fops = { * Perform the freeing of the kmemleak internal objects after waiting for any * current memory scan to complete. */ -static int kmemleak_cleanup_thread(void *arg) +static void kmemleak_do_cleanup(struct work_struct *work) { struct kmemleak_object *object; @@ -1511,22 +1512,9 @@ static int kmemleak_cleanup_thread(void *arg) delete_object_full(object->pointer); rcu_read_unlock(); mutex_unlock(&scan_mutex); - - return 0; } -/* - * Start the clean-up thread. - */ -static void kmemleak_cleanup(void) -{ - struct task_struct *cleanup_thread; - - cleanup_thread = kthread_run(kmemleak_cleanup_thread, NULL, - "kmemleak-clean"); - if (IS_ERR(cleanup_thread)) - pr_warning("Failed to create the clean-up thread\n"); -} +static DECLARE_WORK(cleanup_work, kmemleak_do_cleanup); /* * Disable kmemleak. No memory allocation/freeing will be traced once this @@ -1544,7 +1532,7 @@ static void kmemleak_disable(void) /* check whether it is too early for a kernel thread */ if (atomic_read(&kmemleak_initialized)) - kmemleak_cleanup(); + schedule_work(&cleanup_work); pr_info("Kernel memory leak detector disabled\n"); } @@ -1640,7 +1628,7 @@ static int __init kmemleak_late_init(void) * after setting kmemleak_initialized and we may end up with * two clean-up threads but serialized by scan_mutex. */ - kmemleak_cleanup(); + schedule_work(&cleanup_work); return -ENOMEM; }