Re: [PATCH] kmemleak: Fix scheduling-while-atomic bug
From: Catalin Marinas
Date: Wed Jul 01 2009 - 05:19:35 EST
On Wed, 2009-07-01 at 09:53 +0200, Ingo Molnar wrote:
> * Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx> wrote:
>
> > Gitweb: http://git.kernel.org/linus/acf4968ec9dea49387ca8b3d36dfaa0850bdb2d5
> > Commit: acf4968ec9dea49387ca8b3d36dfaa0850bdb2d5
> > Parent: 4698c1f2bbe44ce852ef1a6716973c1f5401a4c4
> > Author: Catalin Marinas <catalin.marinas@xxxxxxx>
> > AuthorDate: Fri Jun 26 17:38:29 2009 +0100
> > Committer: Catalin Marinas <catalin.marinas@xxxxxxx>
> > CommitDate: Fri Jun 26 17:38:29 2009 +0100
> >
> > kmemleak: Slightly change the policy on newly allocated objects
>
> I think one of the kmemleak fixes that went upstream yesterday
> caused the following scheduling-while-holding-the-tasklist-lock
> regression/crash on x86:
Thanks for the patch. The bug was always there, only that the task stack
scanning is now enabled by default (and I probably have a small number
of tasks that the rescheduling didn't happen during stack scanning).
> The minimal fix below removes scan_yield() and adds a cond_resched()
> to the outmost (safe) place of the scanning thread. This solves the
> regression.
With CONFIG_PREEMPT disabled it won't reschedule during the bss scanning
but I don't see this as a real issue (task stacks scanning probably
takes longer anyway).
> The background scanning thread could probably also be reniced
> to +10.
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index e766e1d..6006553 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1039,6 +1039,7 @@ static int kmemleak_scan_thread(void *arg)
static int first_run = 1;
pr_info("Automatic memory scanning thread started\n");
+ set_user_nice(current, 10);
/*
* Wait before the first scan to allow the system to fully initialize.
--
Catalin
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/