srcu_read_lock_fast_updown(9)
π srcu_read_lock_fast_updown(9) β the Kernel API Manual, bestie edition π
Okay so we're in the Kernel API Manual today, and the whole entire main character of this page is srcu_read_lock_fast_updown. Yes the name is a mouthful, no we are not abbreviating it, she earned every syllable. π
β¨ NAME β¨
srcu_read_lock_fast_updown β register a new reader for an SRCU-fast-updown structure. That's it, that's the job, and she does it flawlessly. π¦
πΈ SYNOPSIS πΈ
struct srcu_ctr __percpu * srcu_read_lock_fast_updown (struct
srcu_struct *ssp );
Not me typing __percpu with a straight face. Iconic signature, no notes. π
π ARGUMENTS π
sspβ thesrcu_structyou're registering your shiny new reader in. That's the one. That's the whole argument. π«Ά
π DESCRIPTION π
Okay so picture this: you're entering an SRCU read-side critical section, but make it the light-weight version β specifically for an smp_mb-free reader. If you want the full lore, go check srcu_read_lock, she explains everything. This function is compatible with srcu_down_read_fast, but bestie, hear me β it is not NMI-safe. Not even a little. π
Now for the rules, because there are always rules:
For srcu_read_lock_fast_updown to be used on an srcu_struct structure, that structure has to have been defined one of two ways:
- using
DEFINE_SRCU_FAST_UPDOWN, or - using
DEFINE_STATIC_SRCU_FAST_UPDOWN,
or, on the other hand, it must have been initialized with init_srcu_struct_fast_updown.
That's non-negotiable. A structure like that cannot be passed to any non-fast-updown variant of srcu_read_{,un}lock or srcu_{down,up}_read. Associated, not interchangeable, iykyk. And in kernels built with CONFIG_PROVE_RCU=y, __srcu_check_read_flavor will complain bitterly if you ignore this * restriction. Bitterly. You've been warned. π
Also slay while knowing this: grace-period auto-expediting is disabled for SRCU-fast-updown srcu_struct structures. The reason is that SRCU-fast-updown expedited grace periods invoke synchronize_rcu_expedited, IPIs and all. So if you truly need expedited SRCU-fast-updown grace periods, use synchronize_srcu_expedited. Simple as that. β
And one more vibe check: srcu_read_lock_fast_updown can be invoked only from those contexts where RCU is watching β like, the contexts where it would be legal to invoke rcu_read_lock. Wander outside that and lockdep will complain. Loudly. π
No cap: wrong flavor of srcu_struct, wrong context, or an NMI, and the kernel will be giving you a look. π
π₯ SEE ALSO π₯
Kernel file ./include/linux/srcu.h, plus the whole friend group:
get_completed_synchronize_srcu(9)same_state_synchronize_srcu(9)srcu_read_lock_held(9)srcu_dereference_check(9)srcu_dereference(9)srcu_dereference_notrace(9)srcu_read_lock(9)srcu_read_lock_fast(9)srcu_down_read_fast(9)srcu_read_lock_nmisafe(9)srcu_down_read(9)srcu_read_unlock(9)srcu_read_unlock_fast(9)srcu_read_unlock_fast_updown(9)srcu_up_read_fast(9)srcu_read_unlock_nmisafe(9)srcu_up_read(9)smp_mb__after_srcu_read_unlock(9)smp_mb__after_srcu_read_lock(9)
Okay that's the whole page, mwah. π This little masterpiece lives in ./include/linux, dated October 2026, and it answers to srcu_read_lock_fast_updown(9) β remember her name, she's going places. ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms