diff options
| author | Kunwu Chan <kunwu.chan@gmail.com> | 2026-09-11 15:21:25 +0800 |
|---|---|---|
| committer | Paul E. McKenney <paulmck@kernel.org> | 2026-10-12 16:50:40 -0700 |
| commit | 378ee30c813edf9e015eb1493cf2188f25682a31 (patch) | |
| tree | 5f922ceb7eef6db2fa4624abb7b27cdc35c3936b /kernel | |
| parent | cbd520f619714e88cca1b814ae3486427133e9ed (diff) | |
| download | linux-378ee30c813edf9e015eb1493cf2188f25682a31.tar.gz linux-378ee30c813edf9e015eb1493cf2188f25682a31.zip | |
srcutree: Don't transition atomic SRCU to big in srcu_gp_end()
Atomic SRCU must remain in the small size state. Warn if this
invariant is violated and avoid transitioning to big in that case.
[ paulmck: Folded "if" onto one line for 100-character limit. ]
Signed-off-by: Kunwu Chan <kunwu.chan@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Bradley Morgan <brads@mainlining.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/rcu/srcutree.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 4e9a0b8ea344..6a05bd8a6f39 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1073,8 +1073,10 @@ 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) { if (ss_state == SRCU_SIZE_ALLOC) init_srcu_struct_nodes(ssp, GFP_KERNEL); else |
