public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] kmemleak: Scan all thread stacks
Date: Wed, 22 Jul 2009 13:16:38 -0700	[thread overview]
Message-ID: <20090722201638.GI6757@linux.vnet.ibm.com> (raw)
In-Reply-To: <1248282209.31275.68.camel@pc1117.cambridge.arm.com>

On Wed, Jul 22, 2009 at 06:03:29PM +0100, Catalin Marinas wrote:
> On Wed, 2009-07-22 at 09:18 -0700, Paul E. McKenney wrote:
> > On Fri, Jul 17, 2009 at 07:01:09PM +0200, Peter Zijlstra wrote:
> > > On Fri, 2009-07-17 at 17:57 +0100, Catalin Marinas wrote:
> > > > On Fri, 2009-07-17 at 18:43 +0200, Ingo Molnar wrote:
> > > > > * Catalin Marinas <catalin.marinas@arm.com> wrote:
> > > > > > 2. Is it safe to use rcu_read_lock() and task_lock() when scanning the
> > > > > >    corresponding kernel stack (thread_info structure)? The loop doesn't
> > > > > >    do any modification to the task list. The reason for this is to
> > > > > >    allow kernel preemption when scanning the stacks.
> > > > > 
> > > > > you cannot generally preempt while holding the RCU read-lock.
> > > > 
> > > > This may work with rcupreempt enabled. But, with classic RCU is it safe
> > > > to call schedule (or cond_resched) while holding the RCU read-lock?
> > > 
> > > No.
> > 
> > What Peter said!  ;-)
> > 
> > However, you might be able to use SRCU (http://lwn.net/Articles/202847/),
> > which does allow blocking within read-side critical sections.
> 
> Thanks for the suggestion. But this would mean that the task_struct
> creation/deletion code should use the SRCU as well which I wouldn't
> modify. I'm also not entirely sure this could replace
> read_lock(&tasklist_lock)/read_unlock (as per the initial question).
> 
> The simplest fix for kmemleak is to not traverse the task list at all -
> http://lkml.org/lkml/2009/7/20/55. The patch is just like any other
> kmemleak annotation in the kernel.

Even better, agreed!

							Thanx, Paul

      reply	other threads:[~2009-07-22 20:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17  9:38 [RFC PATCH] kmemleak: Scan all thread stacks Catalin Marinas
2009-07-17 16:43 ` Ingo Molnar
2009-07-17 16:57   ` Catalin Marinas
2009-07-17 17:01     ` Peter Zijlstra
2009-07-20 10:09       ` Catalin Marinas
2009-07-22 16:18       ` Paul E. McKenney
2009-07-22 17:03         ` Catalin Marinas
2009-07-22 20:16           ` Paul E. McKenney [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090722201638.GI6757@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox