[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4b192489-ed1d-179b-ea35-cc9b23b8f389@quicinc.com>
Date: Wed, 1 Dec 2021 14:55:46 +0530
From: Neeraj Upadhyay <quic_neeraju@...cinc.com>
To: Frederic Weisbecker <frederic@...nel.org>,
"Paul E . McKenney" <paulmck@...nel.org>
CC: LKML <linux-kernel@...r.kernel.org>,
Uladzislau Rezki <urezki@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Josh Triplett <josh@...htriplett.org>,
Joel Fernandes <joel@...lfernandes.org>, <rcu@...r.kernel.org>
Subject: Re: [PATCH 2/6] rcu/nocb: Prepare nocb_cb_wait() to start with a
non-offloaded rdp
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@...nel.org>
> Cc: Neeraj Upadhyay <quic_neeraju@...cinc.com>
> Cc: Boqun Feng <boqun.feng@...il.com>
> Cc: Uladzislau Rezki <urezki@...il.com>
> Cc: Josh Triplett <josh@...htriplett.org>
> Cc: Joel Fernandes <joel@...lfernandes.org>
> ---
Reviewed-by: Neeraj Upadhyay <quic_neeraju@...cinc.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));
> }
>
> /*
>
Powered by blists - more mailing lists