On Mon, Sep 07, 2026 at 03:58:27PM +0800, Kunwu Chan wrote:
> From: Kunwu Chan <[email protected]>
> 
> The atomic-SRCU path in srcu_barrier() sleeps for 100 milliseconds just
> in case there are callbacks to wait for.  But call_srcu() refuses
> atomic SRCU with a WARN_ON_ONCE() before reaching the deferred-enqueue
> path, so there can be no callbacks, deferred or otherwise.
> 
> Drop the sleep.
> 
> Signed-off-by: Kunwu Chan <[email protected]>

Good catch!  As you say, now that call_srcu() leaks callbacks that are
for atomic srcu_struct structures, there really cannot be any callbacks.
Queued for further review and testing, thank you!

                                                        Thanx, Paul

> ---
>  kernel/rcu/srcutree.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index c19f59725706..a93bf803e2f7 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -1895,12 +1895,9 @@ void srcu_barrier(struct srcu_struct *ssp)
>       unsigned long s;
>  
>       check_init_srcu_struct(ssp, false);
> -     if (WARN_ON_ONCE(ssp->srcu_reader_flavor == SRCU_READ_FLAVOR_ATOMIC)) {
> -             // There shouldn't be any callbacks for atomic SRCU,
> -             // but just in case.
> -             schedule_timeout_uninterruptible(HZ/10);
> +     // Atomic SRCU has no callbacks, so there is nothing to wait on.
> +     if (WARN_ON_ONCE(ssp->srcu_reader_flavor == SRCU_READ_FLAVOR_ATOMIC))
>               return;
> -     }
>  
>       /*
>        * Register any deferred callbacks before snapshotting the sequence.  
> The
> -- 
> 2.43.0
> 

Reply via email to