Re: [PATCH RFC tip/core/rcu] accelerate grace period if last non-dynticked CPU

Steven Rostedt
2010-01-25T15:08:24Z

On Mon, 2010-01-25 at 20:28 +0800, Lai Jiangshan wrote:
> Paul E. McKenney wrote:

> > + /* Don't bother unless we are the last non-dyntick-idle CPU. */
> > + for_each_cpu(thatcpu, nohz_cpu_mask)
> > + if (thatcpu != cpu)
> > + return rcu_needs_cpu_quick_check(cpu);
>
> The comment and the code are not the same, I think.
>

I once heard this quote, but I don't know who said it:

"If the comment and the code do not match, they probably are both wrong"

Anyway, you are correct, the comment does not match, but I think the
code is wrong. The code returns if any cpu is in non-dyntick-idle state.
Reading the change log, that looks wrong. Perhaps this is what was
needed:

for_each_online_cpu(thatcpu) {
if (thatcpu != cpu && !cpumask_test_cpu(thatcpu, nohz_cpu_mask)
return rcu_needs_cpu_quick_check(cpu);
}

-- Steve