lkml.org 
[lkml]   [2008]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] ftrace: use struct pid
From
Date
On Thu, 2008-12-04 at 05:40 -0800, Eric W. Biederman wrote:
> Dave Hansen <dave@linux.vnet.ibm.com> writes:
> > 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).
>
> We probably should. Historically read_lock(&tasklist_lock) implies
> rcu_read_lock(). And the tasklist lock is what we hold when it is
> safe.

So, Dipankar tells me that you really do need rcu_read_lock/unlock() for
the guarantee here; the tasklist lock is not sufficient. The realtime
kernel will preempt even those sections covered by spinlocks.

-- Dave



\
 
 \ /
  Last update: 2008-12-04 16:47    [W:0.073 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site