[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20111201132911.e20f1fa3.akpm@linux-foundation.org>
Date: Thu, 1 Dec 2011 13:29:11 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Cyrill Gorcunov <gorcunov@...il.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
linux-kernel@...r.kernel.org, Tejun Heo <tj@...nel.org>,
Andrew Vagin <avagin@...nvz.org>,
Serge Hallyn <serge.hallyn@...onical.com>,
Pavel Emelyanov <xemul@...allels.com>,
Vasiliy Kulikov <segoon@...nwall.com>
Subject: Re: [rfc 2/3] fs, proc: Introduce the Children: line in
/proc/<pid>/status
On Thu, 1 Dec 2011 13:54:34 +0400
Cyrill Gorcunov <gorcunov@...il.com> wrote:
> +int proc_pid_children(struct seq_file *m, struct pid_namespace *ns,
> + struct pid *pid, struct task_struct *task)
> +{
> + struct task_struct *c;
> +
> + read_lock(&tasklist_lock);
> + list_for_each_entry(c, &task->children, sibling)
> + seq_printf(m, " %d", pid_nr_ns(task_pid(c), ns));
> + read_unlock(&tasklist_lock);
> + seq_putc(m, '\n');
> +
> + return 0;
> +}
That's a potentially very long hold time for tasklist_lock, and
userspace can invoke this at a high frequency. Not good.
I think this can all be done under rcu_read_lock() with
list_for_each_entry_rcu().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists