srcu_read_lock_held(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the srcu_struct structure 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:


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