Re: [RFC PATCH 4/5] RCU: Add TASK_RCU_OFFSET

From: Peter Zijlstra
Date: Mon Apr 11 2011 - 17:25:17 EST


On Mon, 2011-04-11 at 14:02 -0700, Paul E. McKenney wrote:
> On Mon, Apr 11, 2011 at 04:31:10PM +0800, Lai Jiangshan wrote:
> > On 04/11/2011 01:12 PM, Paul E. McKenney wrote:
> >
> > > -static inline struct task_struct *next_thread(const struct task_struct *p)
> > > -{
> > > - return list_entry_rcu(p->thread_group.next,
> > > - struct task_struct, thread_group);
> > > -}
> > > +/* Avoid #include hell for inlining rcu_read_lock(). */
> > > +#define next_thread(p) \
> > > + list_entry_rcu((p)->thread_group.next, struct task_struct, thread_group)
> > >

> > I admit the work will become very much simpler if this pattern is allowed.
>
> The guy who maintains much of sched.h suggested it. ;-)

While its not the nicest thing its something that's on more than one
occasion there's an existing site in sched.h and there's on in key.h and
iirc there's another one that's relevant.

A nice solution would be to move a lot of things out of sched.h into
something like process.h, a header that deals with task groups and
processes.

But until that time, I see no problem with using this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/