Messages in this thread | | | Date | Wed, 1 Dec 2021 14:55:46 +0530 | Subject | Re: [PATCH 2/6] rcu/nocb: Prepare nocb_cb_wait() to start with a non-offloaded rdp | From | Neeraj Upadhyay <> |
| |
On 11/23/2021 6:07 AM, Frederic Weisbecker wrote: > In order to be able to toggle the offloaded state from cpusets, a nocb > kthread will need to be created for all possible CPUs whenever the > "rcu_nocbs=" or "nohz_full=" parameters are passed. > > Therefore nocb_cb_wait() kthread must prepare to start running on a > de-offloaded rdp. Simply move the sleeping condition in the beginning > of the kthread callback is enough to prevent from running callbacks > before the rdp ever becomes offloaded. > > Signed-off-by: Frederic Weisbecker <frederic@kernel.org> > Cc: Neeraj Upadhyay <quic_neeraju@quicinc.com> > Cc: Boqun Feng <boqun.feng@gmail.com> > Cc: Uladzislau Rezki <urezki@gmail.com> > Cc: Josh Triplett <josh@joshtriplett.org> > Cc: Joel Fernandes <joel@joelfernandes.org> > ---
Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com>
Thanks Neeraj
> kernel/rcu/tree_nocb.h | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > > diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h > index cc1165559177..e1cb06840454 100644 > --- a/kernel/rcu/tree_nocb.h > +++ b/kernel/rcu/tree_nocb.h > @@ -797,6 +797,18 @@ static void nocb_cb_wait(struct rcu_data *rdp) > bool can_sleep = true; > struct rcu_node *rnp = rdp->mynode; > > + do { > + swait_event_interruptible_exclusive(rdp->nocb_cb_wq, > + nocb_cb_wait_cond(rdp)); > + > + // VVV Ensure CB invocation follows _sleep test. > + if (smp_load_acquire(&rdp->nocb_cb_sleep)) { // ^^^ > + WARN_ON(signal_pending(current)); > + trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("WokeEmpty")); > + } > + } while (!nocb_cb_can_run(rdp)); > + > + > local_irq_save(flags); > rcu_momentary_dyntick_idle(); > local_irq_restore(flags); > @@ -849,17 +861,6 @@ static void nocb_cb_wait(struct rcu_data *rdp) > > if (needwake_state) > swake_up_one(&rdp->nocb_state_wq); > - > - do { > - swait_event_interruptible_exclusive(rdp->nocb_cb_wq, > - nocb_cb_wait_cond(rdp)); > - > - // VVV Ensure CB invocation follows _sleep test. > - if (smp_load_acquire(&rdp->nocb_cb_sleep)) { // ^^^ > - WARN_ON(signal_pending(current)); > - trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("WokeEmpty")); > - } > - } while (!nocb_cb_can_run(rdp)); > } > > /* >
| |