From: Kunwu Chan <[email protected]> The transition-to-big code path in srcu_gp_end() calls init_srcu_struct_nodes() with GFP_KERNEL, which is illegal in the atomic context reachable from synchronize_srcu_atomic(). Atomic SRCU has no use for the srcu_node combining tree: it has neither callbacks nor srcu_barrier() operations, and its grace periods are serialized by ->srcu_atomic_gp_flag instead.
Skip this transition entirely for atomic SRCU, which is also defense in depth against any path that might wrongly set ->srcu_size_state for an atomic srcu_struct. Signed-off-by: Kunwu Chan <[email protected]> --- kernel/rcu/srcutree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c index 01f224a56b41..74acd5645d4c 100644 --- a/kernel/rcu/srcutree.c +++ b/kernel/rcu/srcutree.c @@ -1074,8 +1074,9 @@ 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 (!is_atomic && ss_state != SRCU_SIZE_SMALL && + ss_state != SRCU_SIZE_BIG) { if (ss_state == SRCU_SIZE_ALLOC) init_srcu_struct_nodes(ssp, GFP_KERNEL); else -- 2.43.0

