lkml.org 
[lkml]   [2009]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] kmemleak: Fix scheduling-while-atomic bug
From
Date
On Wed, 2009-07-01 at 09:53 +0200, Ingo Molnar wrote:
> * Linux Kernel Mailing List <linux-kernel@vger.kernel.org> wrote:
>
> > Gitweb: http://git.kernel.org/linus/acf4968ec9dea49387ca8b3d36dfaa0850bdb2d5
> > Commit: acf4968ec9dea49387ca8b3d36dfaa0850bdb2d5
> > Parent: 4698c1f2bbe44ce852ef1a6716973c1f5401a4c4
> > Author: Catalin Marinas <catalin.marinas@arm.com>
> > AuthorDate: Fri Jun 26 17:38:29 2009 +0100
> > Committer: Catalin Marinas <catalin.marinas@arm.com>
> > 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



\
 
 \ /
  Last update: 2009-07-01 11:21    [W:0.793 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site