summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVegard Nossum2016-07-29 00:48:32 +0200
committerLinus Torvalds2016-07-29 01:07:41 +0200
commit98c42d945238c55ab56e5716e89553fb7de45b66 (patch)
tree37153594a46e04d5cd0a54a8d88d271f88e698b3
parentarm64:acpi: fix the acpi alignment exception when 'mem=' specified (diff)
downloadkernel-qcow2-linux-98c42d945238c55ab56e5716e89553fb7de45b66.tar.gz
kernel-qcow2-linux-98c42d945238c55ab56e5716e89553fb7de45b66.tar.xz
kernel-qcow2-linux-98c42d945238c55ab56e5716e89553fb7de45b66.zip
kmemleak: don't hang if user disables scanning early
If the user tries to disable automatic scanning early in the boot process using e.g.: echo scan=off > /sys/kernel/debug/kmemleak then this command will hang until SECS_FIRST_SCAN (= 60) seconds have elapsed, even though the system is fully initialised. We can fix this using interruptible sleep and checking if we're supposed to stop whenever we wake up (like the rest of the code does). Link: http://lkml.kernel.org/r/1468835005-2873-1-git-send-email-vegard.nossum@oracle.com Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/kmemleak.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 04320d3adbef..086292f7c59d 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1485,8 +1485,10 @@ static int kmemleak_scan_thread(void *arg)
* Wait before the first scan to allow the system to fully initialize.
*/
if (first_run) {
+ signed long timeout = msecs_to_jiffies(SECS_FIRST_SCAN * 1000);
first_run = 0;
- ssleep(SECS_FIRST_SCAN);
+ while (timeout && !kthread_should_stop())
+ timeout = schedule_timeout_interruptible(timeout);
}
while (!kthread_should_stop()) {