Re: [PATCH RFC tip/core/rcu 27/28] rcu: Allow dyntick-idle modefor CPUs with callbacks

From: Paul E. McKenney
Date: Thu Nov 03 2011 - 15:53:46 EST


On Wed, Nov 02, 2011 at 09:47:44PM -0700, Josh Triplett wrote:
> On Wed, Nov 02, 2011 at 01:30:48PM -0700, Paul E. McKenney wrote:
> > /*
> > - * Check to see if any future RCU-related work will need to be done
> > - * by the current CPU, even if none need be done immediately, returning
> > - * 1 if so. This function is part of the RCU implementation; it is -not-
> > - * an exported member of the RCU API.
> > + * Allow the CPU to enter dyntick-idle mode if either: (1) There are no
> > + * callbacks on this CPU, (2) this CPU has not yet attempted to enter
> > + * dyntick-idle mode, and (3) this CPU is in the process of attempting to
> > + * enter dyntick-idle mode. Otherwise, if we have recently tried and failed
>
> This sentence doesn't quite work; "if either...and..." should become
> "either...or" or "if...and".

Good eyes -- "or" it is!

> > + * to enter dyntick-idle mode, we refuse to try to enter it. After all,
> > + * it is better to incur scheduling-clock interrupts than to spin
> > + * continuously for the same time duration!
> > + */
> > +int rcu_needs_cpu(int cpu)
> > +{
> > + /* If no callbacks, RCU doesn't need the CPU. */
> > + if (!rcu_cpu_has_callbacks(cpu))
> > + return 0;
> > + /* Otherwise, RCU needs the CPU only if it recently tried and failed. */
> > + return per_cpu(rcu_dyntick_holdoff, cpu) == jiffies;
>
> Sigh, one more use of jiffies. :(

Your suggested alternative? I need something cheap, doesn't need to
be accurate to more than a few milliseconds, needs to be synchronized
across all CPUs.

Thanx, Paul

--
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/