[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221006191225.GD4196@paulmck-ThinkPad-P17-Gen-1>
Date: Thu, 6 Oct 2022 12:12:25 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: "Joel Fernandes (Google)" <joel@...lfernandes.org>
Cc: rcu@...r.kernel.org, linux-kernel@...r.kernel.org,
rushikesh.s.kadam@...el.com, urezki@...il.com,
neeraj.iitr10@...il.com, frederic@...nel.org, rostedt@...dmis.org,
youssefesmat@...gle.com, surenb@...gle.com
Subject: Re: [PATCH v7 03/11] rcu: Refactor code a bit in
rcu_nocb_do_flush_bypass()
On Tue, Oct 04, 2022 at 02:41:49AM +0000, Joel Fernandes (Google) wrote:
> This consolidates the code a bit and makes it cleaner. Functionally it
> is the same.
>
> Reported-by: Paul E. McKenney <paulmck@...nel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
> ---
> kernel/rcu/tree_nocb.h | 17 +++++++++--------
> 1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
> index 56616bfbe156..dfa736da68ab 100644
> --- a/kernel/rcu/tree_nocb.h
> +++ b/kernel/rcu/tree_nocb.h
> @@ -327,10 +327,11 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
> *
> * Note that this function always returns true if rhp is NULL.
> */
> -static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
> +static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp_in,
> unsigned long j, bool lazy)
> {
> struct rcu_cblist rcl;
> + struct rcu_head *rhp = rhp_in;
>
> WARN_ON_ONCE(!rcu_rdp_is_offloaded(rdp));
> rcu_lockdep_assert_cblist_protected(rdp);
> @@ -345,16 +346,16 @@ static bool rcu_nocb_do_flush_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
>
> /*
> * If the new CB requested was a lazy one, queue it onto the main
> - * ->cblist so we can take advantage of a sooner grade period.
> + * ->cblist so that we can take advantage of the grace-period that will
> + * happen regardless. But queue it onto the bypass list first so that
> + * the lazy CB is ordered with the existing CBs in the bypass list.
> */
> if (lazy && rhp) {
> - rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, NULL);
> - rcu_cblist_enqueue(&rcl, rhp);
> - WRITE_ONCE(rdp->lazy_len, 0);
> - } else {
> - rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp);
> - WRITE_ONCE(rdp->lazy_len, 0);
> + rcu_cblist_enqueue(&rdp->nocb_bypass, rhp);
> + rhp = NULL;
> }
> + rcu_cblist_flush_enqueue(&rcl, &rdp->nocb_bypass, rhp);
> + WRITE_ONCE(rdp->lazy_len, 0);
Much much better, thank you!
Thanx, Paul
> rcu_segcblist_insert_pend_cbs(&rdp->cblist, &rcl);
> WRITE_ONCE(rdp->nocb_bypass_first, j);
> --
> 2.38.0.rc1.362.ged0d419d3c-goog
>
Powered by blists - more mailing lists