Re: [PATCH tip/core/rcu 3/6] rcu: Abstract dynticks extended quiescent state enter/exit operations

From: Paul E. McKenney
Date: Mon Jan 16 2017 - 19:12:47 EST


On Mon, Jan 16, 2017 at 11:25:38AM -0800, Josh Triplett wrote:
> On Mon, Jan 16, 2017 at 03:34:20AM -0800, Paul E. McKenney wrote:
> > On Sun, Jan 15, 2017 at 11:47:35PM -0800, Josh Triplett wrote:
> > > On Sat, Jan 14, 2017 at 12:54:42AM -0800, Paul E. McKenney wrote:

[ . . . ]

> > > > @@ -693,7 +752,7 @@ static void rcu_eqs_enter_common(long long oldval, bool user)
> > > > {
> > > > struct rcu_state *rsp;
> > > > struct rcu_data *rdp;
> > > > - struct rcu_dynticks *rdtp = this_cpu_ptr(&rcu_dynticks);
> > > > + struct rcu_dynticks __maybe_unused *rdtp = this_cpu_ptr(&rcu_dynticks);
> > >
> > > Rather than marking a local variable as __maybe_unused (such that the
> > > compiler can no longer help detect it as unused), could you move it into
> > > the portion of the function that uses it, so that if reached, it'll
> > > always get used?
> > >
> > > > trace_rcu_dyntick(TPS("Start"), oldval, rdtp->dynticks_nesting);
> >
> > Its only use is in the above event trace, which can be disabled via
> > CONFIG_RCU_TRACE=n. I could put the definition of rdtp under #ifdef,
> > but this seems ugly. I could eliminate the variable, substituting
> > the initialization for rdtp in the event trace, but that would make
> > for a very long line, or an odd line break.
>
> For the trace_rcu_dyntick calls, you could create a small static inline
> helper to do the tracing, eliminating the third argument. Or you could
> create a helper that returns
> this_cpu_ptr(&rcu_dynticks)->dynticks_nesting. Either way would work.
>
> Or, if you prefer, you could wrap the variable
> declaration/initialization in RCU_TRACE() rather than adding
> __maybe_unused.

RCU_TRACE() it is in both cases, thank you! (You would think I would
remember the code that I wrote...)

Thanx, Paul