On Sun, Sep 13, 2026 at 01:47:05PM +0100, Bradley Morgan wrote:
> On 11 September 2026 08:21:25 BST, Kunwu Chan <[email protected]> wrote:
> 
> Better late than never.
> 
> >Atomic SRCU must remain in the small size state. Warn if this
> >invariant is violated and avoid transitioning to big in that case.
> 
> Fair enough.
> 
> Reviewed-by: Bradley Morgan <[email protected]>

Thank you!  I will apply this on my next rebase.

                                                        Thanx, Paul

> >Signed-off-by: Kunwu Chan <[email protected]>
> >---
> >Changes since v2:
> >- Also prevent the transition when the atomic SRCU size-state
> >  invariant is violated, per Paul McKenney's suggestion.
> >-v2: 
> >https://lore.kernel.org/rcu/[email protected]/
> >
> >Changes since v1:
> >- Drop the !is_atomic guard from v1 and add WARN_ON_ONCE() instead,
> >  per Paul McKenney's suggestion.
> >- v1: 
> >https://lore.kernel.org/rcu/[email protected]/
> >---
> > kernel/rcu/srcutree.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> >
> >diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> >index 84c022ec8e09..07db4e459b30 100644
> >--- a/kernel/rcu/srcutree.c
> >+++ b/kernel/rcu/srcutree.c
> >@@ -1073,8 +1073,11 @@ static void srcu_gp_end(struct srcu_struct *ssp, bool 
> >is_atomic)
> >             raw_spin_unlock_irq_rcu_node(sup);
> >     }
> > 
> >-    /* Transition to big if needed. */
> >-    if (ss_state != SRCU_SIZE_SMALL && ss_state != SRCU_SIZE_BIG) {
> >+    /* Transition to big if needed, but never for atomic SRCU. */
> >+    if (ssp->srcu_reader_flavor == SRCU_READ_FLAVOR_ATOMIC &&
> >+        ss_state != SRCU_SIZE_SMALL) {
> >+            WARN_ON_ONCE(1);
> >+    } else if (ss_state != SRCU_SIZE_SMALL && ss_state != SRCU_SIZE_BIG) {
> 
> I like this fix.
> 
> >             if (ss_state == SRCU_SIZE_ALLOC)
> >                     init_srcu_struct_nodes(ssp, GFP_KERNEL);
> >             else
> >
> 
> --- Thanks!
> https://lore.kernel.org/all/[email protected]/

Reply via email to