[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200611013426.GB12037@google.com>
Date: Wed, 10 Jun 2020 21:34:26 -0400
From: Joel Fernandes <joel@...lfernandes.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: "Paul E . McKenney" <paulmck@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH 06/10] rcu: Make nocb_cb kthread parkable
On Wed, May 13, 2020 at 06:47:10PM +0200, Frederic Weisbecker wrote:
> This will be necessary to correctly implement rdp de-offloading. We
> don't want rcu_do_batch() in nocb_cb kthread to race with local
> rcu_do_batch().
>
> Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> Cc: Paul E. McKenney <paulmck@...nel.org>
> Cc: Josh Triplett <josh@...htriplett.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Lai Jiangshan <jiangshanlai@...il.com>
> Cc: Joel Fernandes <joel@...lfernandes.org>
Reviewed-by: Joel Fernandes (Google) <joel@...lfernandes.org>
thanks,
- Joel
> ---
> kernel/rcu/tree_plugin.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
> index 1dd3fdd675a1..43ecc047af26 100644
> --- a/kernel/rcu/tree_plugin.h
> +++ b/kernel/rcu/tree_plugin.h
> @@ -2104,7 +2104,9 @@ static void nocb_cb_wait(struct rcu_data *rdp)
> if (needwake_gp)
> rcu_gp_kthread_wake();
> swait_event_interruptible_exclusive(rdp->nocb_cb_wq,
> - !READ_ONCE(rdp->nocb_cb_sleep));
> + !READ_ONCE(rdp->nocb_cb_sleep) ||
> + kthread_should_park());
> +
> if (!smp_load_acquire(&rdp->nocb_cb_sleep)) { /* VVV */
> /* ^^^ Ensure CB invocation follows _sleep test. */
> return;
> @@ -2125,6 +2127,8 @@ static int rcu_nocb_cb_kthread(void *arg)
> // if there are no more ready callbacks, waits for them.
> for (;;) {
> nocb_cb_wait(rdp);
> + if (kthread_should_park())
> + kthread_parkme();
> cond_resched_tasks_rcu_qs();
> }
> return 0;
> --
> 2.25.0
>
Powered by blists - more mailing lists