[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200922002214.GQ29330@paulmck-ThinkPad-P72>
Date: Mon, 21 Sep 2020 17:22:15 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: Frederic Weisbecker <frederic@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Lai Jiangshan <jiangshanlai@...il.com>,
Joel Fernandes <joel@...lfernandes.org>,
Josh Triplett <josh@...htriplett.org>
Subject: Re: [RFC PATCH 10/12] rcu: Process batch locally as long as
offloading isn't complete
On Mon, Sep 21, 2020 at 02:43:49PM +0200, Frederic Weisbecker wrote:
> During the offloading or de-offloading process, make sure to process
> the callbacks batch locally whenever the segcblist isn't entirely
> offloaded. This enforces callback service processing while we are still
> in intermediate (de-)offloading state.
>
> FIXME: Note that __call_rcu_core() isn't called during these intermediate
> states. Some pieces there may still be necessary.
Joel's per-segment callback-count work might help there, though I believe
that to be a separate issue.
The key point is that if there are a lot of callbacks, but all of them
are ready to be invoked, then there isn't much point in making the
grace periods complete faster. Right now, lacking per-segment counts,
RCU just assumes that none of the callbacks are ready to be invoked.
Thanx, Paul
> Inspired-by: Paul E. McKenney <paulmck@...nel.org>
> 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>
> ---
> kernel/rcu/rcu_segcblist.h | 12 ++++++++++++
> kernel/rcu/tree.c | 3 ++-
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/rcu_segcblist.h b/kernel/rcu/rcu_segcblist.h
> index 00ebeb8d39b7..f7da3d535888 100644
> --- a/kernel/rcu/rcu_segcblist.h
> +++ b/kernel/rcu/rcu_segcblist.h
> @@ -92,6 +92,18 @@ static inline bool rcu_segcblist_is_offloaded(struct rcu_segcblist *rsclp)
> return false;
> }
>
> +static inline bool rcu_segcblist_completely_offloaded(struct rcu_segcblist *rsclp)
> +{
> + int flags = SEGCBLIST_KTHREAD_CB | SEGCBLIST_KTHREAD_GP | SEGCBLIST_OFFLOADED;
> +
> + if (IS_ENABLED(CONFIG_RCU_NOCB_CPU)) {
> + if ((rsclp->flags & flags) == flags)
> + return true;
> + }
> +
> + return false;
> +}
> +
> /*
> * Are all segments following the specified segment of the specified
> * rcu_segcblist structure empty of callbacks? (The specified
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index b4292489db0c..928907e9ba94 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2620,6 +2620,7 @@ static __latent_entropy void rcu_core(void)
> struct rcu_data *rdp = raw_cpu_ptr(&rcu_data);
> struct rcu_node *rnp = rdp->mynode;
> const bool offloaded = rcu_segcblist_is_offloaded(&rdp->cblist);
> + const bool do_batch = !rcu_segcblist_completely_offloaded(&rdp->cblist);
>
> if (cpu_is_offline(smp_processor_id()))
> return;
> @@ -2649,7 +2650,7 @@ static __latent_entropy void rcu_core(void)
> rcu_check_gp_start_stall(rnp, rdp, rcu_jiffies_till_stall_check());
>
> /* If there are callbacks ready, invoke them. */
> - if (!offloaded && rcu_segcblist_ready_cbs(&rdp->cblist) &&
> + if (do_batch && rcu_segcblist_ready_cbs(&rdp->cblist) &&
> likely(READ_ONCE(rcu_scheduler_fully_active)))
> rcu_do_batch(rdp);
>
> --
> 2.28.0
>
Powered by blists - more mailing lists