On Wed, Nov 24, 2021 at 04:30:26PM -0800, Paul E. McKenney wrote: > On Tue, Nov 23, 2021 at 01:37:05AM +0100, Frederic Weisbecker wrote: > > Currently cpumask_available() is used to prevent from unwanted > > NOCB initialization. However if neither "rcu_nocbs=" nor "nohz_full=" > > parameters are passed but CONFIG_CPUMASK_OFFSTACK=n, the initialization > > path is still taken, running through all sorts of needless operations > > and iterations on an empty cpumask. > > > > Fix this with relying on a real initialization state instead. This > > also optimize kthreads creation, sparing iteration over all online CPUs > > when nocb isn't initialized. > > > > Signed-off-by: Frederic Weisbecker <frederic@xxxxxxxxxx> > > Cc: Neeraj Upadhyay <quic_neeraju@xxxxxxxxxxx> > > Cc: Boqun Feng <boqun.feng@xxxxxxxxx> > > Cc: Uladzislau Rezki <urezki@xxxxxxxxx> > > Cc: Josh Triplett <josh@xxxxxxxxxxxxxxxx> > > Cc: Joel Fernandes <joel@xxxxxxxxxxxxxxxxx> > > --- > > kernel/rcu/tree_nocb.h | 24 +++++++++++++++++------- > > 1 file changed, 17 insertions(+), 7 deletions(-) > > > > diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h > > index e1cb06840454..d8ed3ee47a67 100644 > > --- a/kernel/rcu/tree_nocb.h > > +++ b/kernel/rcu/tree_nocb.h > > @@ -60,6 +60,9 @@ static inline bool rcu_current_is_nocb_kthread(struct rcu_data *rdp) > > * Parse the boot-time rcu_nocb_mask CPU list from the kernel parameters. > > * If the list is invalid, a warning is emitted and all CPUs are offloaded. > > */ > > + > > +static bool rcu_nocb_is_setup; > > I am taking this as is for now (modulo wordsmithing), but should this > variable instead be in the rcu_state structure? The advantage of putting > it there is keeping the state together. The corresponding disadvantage > is that the state is globally visible within RCU. > > Thoughts? Yes good point, will do! Thanks!