lkml.org 
[lkml]   [2009]   [Jul]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] kmemleak: Scan all thread stacks

* 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


\
 
 \ /
  Last update: 2009-07-17 18:47    [W:0.039 / U:28.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site