public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Catalin Marinas <catalin.marinas@arm.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"Paul E. McKenney" <paulmck@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] kmemleak: Scan all thread stacks
Date: Fri, 17 Jul 2009 18:43:46 +0200	[thread overview]
Message-ID: <20090717164346.GC5131@elte.hu> (raw)
In-Reply-To: <20090717093359.8288.45464.stgit@pc1117.cambridge.arm.com>


* Catalin Marinas <catalin.marinas@arm.com> wrote:

> This patch changes the for_each_process() loop with the
> do_each_thread()/while_each_thread() pair. It also replaces the
> read_lock(&tasklist_lock) with rcu_read_lock() and task_lock(p).
> 
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
> 
> My questions:
> 
> 1. Is it correct that for_each_process() used currently by kmemleak may
>    not loop through all the possible kernel thread stacks?

yes. You need the full, all tasks variant:

        do_each_thread(g, p) {
        ...
        } while_each_thread(g, p);


> 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.

	Ingo

  reply	other threads:[~2009-07-17 16:44 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 [this message]
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

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=20090717164346.GC5131@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=catalin.marinas@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@us.ibm.com \
    /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