rcu_read_lock_sched(9)
π rcu_read_lock_sched β a Kernel API Manual moment π
okay so bestie, welcome to rcu_read_lock_sched(9) from the Kernel API Manual. this is the page, and it's giving "small but mighty" β¨ let's get into it π
πΈ NAME πΈ
rcu_read_lock_sched β mark the beginning of a RCU-sched critical section
like, it's literally the "start here" flag for an RCU-sched critical section, no cap π
β¨ SYNOPSIS β¨
void rcu_read_lock_sched (void );
π¦ ARGUMENTS π¦
voidβ no arguments. that's it. nothing. zero. the void is voiding π
π DESCRIPTION π
so here's the tea β β this is equivalent to rcu_read_lock, but it also disables preemption. two-for-one behavior, iconic.
read-side critical sections can also be introduced by anything else that disables preemption, including local_irq_disable and friends. so like, there's more than one way into the party π but heads up, bestie:
π¨ important caveat incoming π¨ β the equivalence torcu_read_lockapplies only to v5.0 and later. before v5.0,rcu_read_lockandrcu_read_lock_schedwere unrelated. like, total strangers. not even mutuals. π
and another thing, and this one is fr fr serious: rcu_read_lock_sched and the matching rcu_read_unlock_sched must occur in the same context. for example, it is illegal to invoke rcu_read_unlock_sched from process context if the matching rcu_read_lock_sched was invoked from an NMI handler. π not "illegal" like a warning, like genuinely not allowed. keep the pair together, they're a set, don't split them up π«Ά
π SEE ALSO π
the whole friend group π β kernel file ./include/linux/rcupdate.h plus:
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_lock_bh(9)rcu_read_unlock_bh(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)
and that's the whole page, bestie, you ate that π mwah π
sign-off time β¨ this iconic little page lives in ./include/linux and the version/date on the tin is October 2026, page name rcu_read_lock_sched(9). go forth and lock sched-ly π§ββοΈπ
π¦ 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