Re: linux-next 20111025: warnings in rcu_idle_exit_common()/rcu_idle_enter_common()

Paul E. McKenney
2011-11-10T17:33:48Z

On Thu, Nov 10, 2011 at 05:35:24PM +0100, Peter Zijlstra wrote:
> On Mon, 2011-10-31 at 15:14 -0700, Paul E. McKenney wrote:
> > Peter, I have been using "idle_cpu(smp_processor_id()))" to verify that
> > I really am running in the context of the idle task when RCU believes
> > that the current CPU has gone idle.
>
> I think this is sorted since, but just to clarify idle_cpu() was meant
> to test if the cpu was idle, this is something different from actually
> running the idle thread.

Thank you, and yes, looks like the ->pid==0 approach works well.

Should this be encapsulated, for example in an inline function something
as follows?

static inline void cpu_is_running_idle_task(struct task_struct *tsk)
{
return tsk->pid == 0;
}

I am sure I could come up with a longer name, if you would prefer. ;-)

I would be happy to create the patch and fix up the other open-coded
uses of ->pid==0 if this approach looks good to you.

Thanx, Paul