srcu_read_lock_held(9)
π srcu_read_lock_held
ok so this is a page from the Kernel API Manual, bestie, and it's about srcu_read_lock_held(9) β the little guy that tells you whether you might be hanging out in an SRCU read-side critical section. let's get into it π
β¨ NAME β¨
srcu_read_lock_held β might we be in SRCU read-side critical section? π
πΈ SYNOPSIS πΈ
int srcu_read_lock_held (const struct srcu_struct *ssp );
π¦ ARGUMENTS π¦
sspβ thesrcu_structstructure you want to check, no cap π
π₯ DESCRIPTION π₯
ok so here's the tea β β if CONFIG_DEBUG_LOCK_ALLOC is selected, this returns nonzero iff you're in an SRCU read-side critical section. literally that simple. β¨
but if CONFIG_DEBUG_LOCK_ALLOC is not there? then it just goes ahead and assumes we're in an SRCU read-side critical section unless it can prove otherwise. optimistic queen energy, honestly π«Ά
it also checks debug_lockdep_rcu_enabled to prevent false positives during boot and while lockdep is disabled. gotta stay accurate, y'know? π
π real talk though: note that SRCU is based on its own statemachine and it doesn't relies on normal RCU, so it can be called from the CPU which is in the idle loop from an RCU point of view or offline. iconic behaviour, honestly π
π SEE ALSO π
Kernel file ./include/linux/srcu.h, plus the whole friend group:
get_completed_synchronize_srcu(9)same_state_synchronize_srcu(9)srcu_dereference_check(9)srcu_dereference(9)srcu_dereference_notrace(9)srcu_read_lock(9)srcu_read_lock_fast(9)srcu_read_lock_fast_updown(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)
anyway that's the whole vibe π this one came straight out of ./include/linux, dated October 2026, and it's filed under srcu_read_lock_held(9). go off, kernel docs ππ
π¦ 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