Re: [PATCH v8 02/13] rcu: Make call_rcu() lazy to save power

From: Frederic Weisbecker
Date: Tue Oct 11 2022 - 19:11:05 EST


On Tue, Oct 11, 2022 at 06:01:31PM +0000, Joel Fernandes (Google) wrote:
> @@ -269,10 +294,14 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,
> raw_spin_lock_irqsave(&rdp_gp->nocb_gp_lock, flags);
>
> /*
> - * Bypass wakeup overrides previous deferments. In case
> - * of callback storm, no need to wake up too early.
> + * Bypass wakeup overrides previous deferments. In case of
> + * callback storm, no need to wake up too early.
> */
> - if (waketype == RCU_NOCB_WAKE_BYPASS) {
> + if (waketype == RCU_NOCB_WAKE_LAZY &&
> + READ_ONCE(rdp->nocb_defer_wakeup) == RCU_NOCB_WAKE_NOT) {

No need for READ_ONCE() here.

> + mod_timer(&rdp_gp->nocb_timer, jiffies + jiffies_till_flush);
> + WRITE_ONCE(rdp_gp->nocb_defer_wakeup, waketype);
> + } else if (waketype == RCU_NOCB_WAKE_BYPASS) {
> mod_timer(&rdp_gp->nocb_timer, jiffies + 2);
> WRITE_ONCE(rdp_gp->nocb_defer_wakeup, waketype);
> } else {
> @@ -611,6 +682,8 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
> unsigned long flags;
> bool gotcbs = false;
> unsigned long j = jiffies;
> + bool lazy = false;
> + long lazy_ncbs;

Looks like lazy_ncbs can be declared withing the loop, as well as bypass_cbs.

Anyway, apart from such boring cosmectics:

Acked-by: Frederic Weisbecker <frederic@xxxxxxxxxx>

Thanks!