[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0812040925390.5240@gandalf.stny.rr.com>
Date: Thu, 4 Dec 2008 09:29:04 -0500 (EST)
From: Steven Rostedt <rostedt@...dmis.org>
To: Dave Hansen <dave@...ux.vnet.ibm.com>
cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
Frederic Weisbecker <fweisbec@...il.com>,
linux-kernel@...r.kernel.org, Steven Rostedt <srostedt@...hat.com>,
containers@...ts.osdl.org, Ingo Molnar <mingo@...e.hu>,
Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 2/3] ftrace: use struct pid
On Thu, 4 Dec 2008, Dave Hansen wrote:
> On Thu, 2008-12-04 at 04:56 -0800, Dave Hansen wrote:
> > On Thu, 2008-12-04 at 04:42 -0800, Eric W. Biederman wrote:
> > >
> > > > +static void clear_ftrace_pid_task(struct pid **pid)
> > > > +{
> > > > + struct task_struct *p;
> > > > +
> > > rcu_read_lock();
> > >
> > > > + do_each_pid_task(*pid, PIDTYPE_PID, p) {
> > > > + clear_tsk_trace_trace(p);
> > > > + } while_each_pid_task(*pid, PIDTYPE_PID, p);
> > > rcu_read_unlock()
> > >
> > > > + put_pid(*pid);
> > > > +
> > > > + *pid = NULL;
> > > > +}
> >
> > Could we get away with sticking the rcu_read_{un}lock() inside those
> > macros? Those are going to get used in pretty high level code and we're
> > allowed to nest rcu_read_lock(). No danger of deadlocks or lock
> > inversions.
>
> Why don't any of the other users of do_each_pid_task() use
> rcu_read_lock()? They all seem to be under read_lock(&tasklist_lock)
> (except one is under a write lock of the same).
Well, if the pid hashes are traversal safe (rcu style), then we only worry
about a node or task being freed. I'm assuming that the node is protected
via RCU as tasks are, then using only rcu_read_lock should be sufficient.
-- Steve
--
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