Re: [PATCH RFC srcu] Expedite srcu_schedule_cbs_snp() callback invocation

From: Marc Zyngier
Date: Tue Apr 18 2017 - 13:43:14 EST


On 18/04/17 18:33, Paul E. McKenney wrote:
> Although Tree SRCU does reduce delays when there is at least one
> synchronize_srcu_expedited() invocation pending, srcu_schedule_cbs_snp()
> still waits for SRCU_INTERVAL before invoking callbacks. Since
> synchronize_srcu_expedited() now posts a callback and waits for
> that callback to do a wakeup, this destroys the expedited nature of
> synchronize_srcu_expedited().
>
> This commit therefore invokes callbacks immediately at the end of the
> grace period when there is at least one synchronize_srcu_expedited()
> invocation pending.
>
> Reported-by: Marc Zyngier <marc.zyngier@xxxxxxx>
> Signed-off-by: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
>
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index 1e54f91c2ff7..744ffdb79d23 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -447,7 +447,8 @@ static void srcu_schedule_cbs_snp(struct srcu_struct *sp, struct srcu_node *snp)
> int cpu;
>
> for (cpu = snp->grplo; cpu <= snp->grphi; cpu++)
> - srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu), SRCU_INTERVAL);
> + srcu_schedule_cbs_sdp(per_cpu_ptr(sp->sda, cpu),
> + atomic_read(&sp->srcu_exp_cnt) ? 0 : SRCU_INTERVAL);
> }
>
> /*

This fixes the issue I was observing, where UEFI in a KVM guest would
take a x8 slowdown while it messes with some NOR flash emulation on
arm64 (don't ask, this is horrible...). Anyway:

Tested-by: Marc Zyngier <marc.zyngier@xxxxxxx>

Thanks again Paul!

M.
--
Jazz is not dead. It just smells funny...