Re: [PATCH] rcu: When rcuog kthreads is in polling mode, wakeup waitqueue is not requried

From: Paul E. McKenney
Date: Sat Jan 29 2022 - 00:36:25 EST


On Fri, Jan 28, 2022 at 11:13:46AM +0800, Zqiang wrote:
> When grace period cleanup, the rcuog kthreads that waiting in sq
> waitqueue will be awakened, however if the 'rcu_nocb_poll' is set,
> the sq waitqueue always empty, so if 'rcu_nocb_poll' is set, return
> directly.

This does decrease grace-period-cleanup overhead in kernels built with
CONFIG_RCU_NOCB_CPU=y and booted with the rcu_nocb_poll kernel boot
parameter set. On the other hand, it increases grace-period-cleanup
overhead in kernels built with CONFIG_RCU_NOCB_CPU=y but booted without
the rcu_nocb_poll kernel boot parameter set.

Last I checked, more kernels were booted without the rcu_nocb_poll kernel
boot parameter set. If this is still the case, this patch would slow
things down for most systems.

Or are there now lots of systems booted with rcu_nocb_poll?

Thanx, Paul

> Signed-off-by: Zqiang <qiang1.zhang@xxxxxxxxx>
> ---
> kernel/rcu/tree_nocb.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
> index 636d0546a4e9..9e106c590e56 100644
> --- a/kernel/rcu/tree_nocb.h
> +++ b/kernel/rcu/tree_nocb.h
> @@ -201,6 +201,8 @@ static void rcu_lockdep_assert_cblist_protected(struct rcu_data *rdp)
> */
> static void rcu_nocb_gp_cleanup(struct swait_queue_head *sq)
> {
> + if (rcu_nocb_poll)
> + return;
> swake_up_all(sq);
> }
>
> --
> 2.25.1
>