rcu_read_lock_bh(9)
π rcu_read_lock_bh β the Kernel API Manual, bestie edition π
Okay so picture this: you're in the kernel, you need an RCU read-side critical section, and you also need softirqs to chill out for a sec. That's literally this function. Welcome to rcu_read_lock_bh π¦
β¨ NAME β¨
rcu_read_lock_bh β mark the beginning of an RCU-bh critical section π
πΈ SYNOPSIS πΈ
void rcu_read_lock_bh (void );
π ARGUMENTS π
voidβ no arguments. Not a single one. She takes nothing and gives everything π
π« DESCRIPTION π«
So here's the tea β: this one is equivalent to rcu_read_lock, except it also disables softirqs. Two-for-one, no cap.
And here's the part people forget: anything else that disables softirqs can also serve as an RCU read-side critical section. So if some other code path is already shutting softirqs down, congrats, you're already in the club π«Ά
π¨ BUT β and I cannot stress this enough β that equivalence applies only to v5.0 and later. Before v5.0,rcu_read_lockandrcu_read_lock_bhwere completely unrelated. Like, not even mutuals. So if you're kicking it on an older kernel, do NOT assume they're the same vibe. Fr fr π
Also, huge one: rcu_read_lock_bh and its matching rcu_read_unlock_bh must occur in the same context π For example, it is illegal to invoke rcu_read_unlock_bh from one task if the matching rcu_read_lock_bh was invoked from some other task. That's not a "eh, probably fine" situation, that's a no. Matching lock and unlock, same task, periodt π
π SEE ALSO π
Kernel file ./include/linux/rcupdate.h, plus literally the whole friend group:
same_state_synchronize_rcu(9)cond_resched_tasks_rcu_qs(9)rcu_softirq_qs_periodic(9)RCU_LOCKDEP_WARN(9)lockdep_assert_in_rcu_read_lock(9)lockdep_assert_in_rcu_read_lock_bh(9)lockdep_assert_in_rcu_read_lock_sched(9)lockdep_assert_in_rcu_reader(9)unrcu_pointer(9)RCU_INITIALIZER(9)rcu_assign_pointer(9)rcu_replace_pointer(9)rcu_access_pointer(9)rcu_dereference_check(9)rcu_dereference_bh_check(9)rcu_dereference_sched_check(9)rcu_dereference_all_check(9)rcu_dereference_protected(9)rcu_dereference(9)rcu_dereference_bh(9)rcu_dereference_sched(9)rcu_dereference_all(9)rcu_pointer_handoff(9)rcu_read_lock(9)rcu_read_unlock(9)rcu_read_unlock_bh(9)rcu_read_lock_sched(9)rcu_read_unlock_sched(9)RCU_INIT_POINTER(9)RCU_POINTER_INITIALIZER(9)kfree_rcu(9)kfree_rcu_mightsleep(9)kfree_rcu_nolock(9)rcu_head_init(9)rcu_head_after_call_rcu(9)
π§ sign-off π§
This icon of a page lives in ./include/linux, and it's stamped October 2026 β rcu_read_lock_bh(9). Go forth, lock that bh section, and remember: same context, bestie. Always. ππ₯
π¦ 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