call_rcu(9)
โจ call_rcu(9) โ like, the whole RCU callback vibe, explained ๐
okay bestie, welcome to the Kernel API Manual page for call_rcu ๐ this is the one where you queue an RCU callback for invocation after a grace period. and by default?? those callbacks are 'lazy' and get kept hidden from the main ->cblist so grace periods don't start too soon ๐ if you actually want grace periods to start very very soon, you go use call_rcu_hurry() instead, mwah ๐
๐ธ SYNOPSIS ๐ธ
void call_rcu (struct rcu_head *head , rcu_callback_t func );
๐ฆ ARGUMENTS ๐ฆ
headโ the structure you're gonna use for queueing the RCU updates. it's giving "designated parking spot" energy ๐ ฟ๏ธโจfuncโ the actual callback function that gets invoked after the grace period. the main character, fr ๐ซถ
๐ DESCRIPTION ๐
so here's the tea โ the callback function gets invoked some time after a full grace period elapses โ in other words, after all pre-existing RCU read-side critical sections have completed. however ๐ญ the callback function might well execute concurrently with RCU read-side critical sections that started after call_rcu was invoked. so like, no, it's not a total lockdown, ok?
and listen โ it is perfectly legal to repost an RCU callback from within its own callback function, potentially with a different callback function ๐ the specified function will then be invoked after another full grace period has elapsed. this use case is similar in form to the common practice of reposting a timer from within its own handler. very "i'm my own sequel" of it, ngl ๐
RCU read-side critical sections are delimited by rcu_read_lock and rcu_read_unlock, and they may be nested ๐ช in addition โ but only in v5.0 and later โ regions of code across which interrupts, preemption, or softirqs have been disabled also serve as RCU read-side critical sections. this includes hardware interrupt handlers, softirq handlers, and NMI handlers ๐ฅ
โ ๏ธ okay this next bit is the important one, don't scroll past it โ ๏ธ
note that all CPUs must agree that the grace period extended beyond all pre-existing RCU read-side critical section(s). on systems with more than one CPU, this means that when "func" is invoked, each CPU is guaranteed to have executed a full memory barrier since the end of its last RCU read-side critical section whose beginning preceded the call to call_rcu. phew ๐ฎโ๐จ
it also means that each CPU executing an RCU read-side critical section that continues beyond the start of "func" must have executed a memory barrier after the call_rcu but before the beginning of that RCU read-side critical section. these guarantees include CPUs that are offline, idle, or executing in user mode, as well as CPUs that are executing in the kernel. literally every CPU, no exceptions, periodt ๐
furthermore ๐ if CPU A invoked call_rcu and CPU B invoked the resulting RCU callback function "func", then both CPU A and CPU B are guaranteed to execute a full memory barrier during the time interval between the call to call_rcu and the invocation of "func" โ even if CPU A and CPU B are the same CPU (but again only if the system has more than one CPU). yes bestie, we said it twice, it's that serious ๐
implementation of these memory-ordering guarantees is described here:
Documentation/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.rst
๐ง specific to call_rcu (vs the other call_rcu*() girlies) ๐ง
in kernels built with CONFIG_RCU_LAZY=y, call_rcu might delay for many seconds before starting the grace period needed by the corresponding callback ๐ด this delay can significantly improve energy-efficiency on low-utilization battery-powered devices ๐โจ which is honestly iconic of it. but to avoid this delay, in latency-sensitive kernel code, use call_rcu_hurry. that's the whole vibe check, iykyk ๐ซถ
๐ SEE ALSO ๐
kernel file ./kernel/rcu/tree.c โ plus the whole friend group ๐
rcu_softirq_qs(9)rcu_watching_snap_stopped_since(9)rcu_is_cpu_rrupt_from_idle(9)rcu_irq_exit_check_preempt(9)__rcu_irq_enter_check_tick(9)rcu_is_watching(9)rcu_set_gpwrap_lag(9)call_rcu_hurry(9)synchronize_rcu(9)get_completed_synchronize_rcu_full(9)get_state_synchronize_rcu(9)get_state_synchronize_rcu_full(9)start_poll_synchronize_rcu(9)start_poll_synchronize_rcu_full(9)poll_state_synchronize_rcu(9)poll_state_synchronize_rcu_full(9)cond_synchronize_rcu(9)cond_synchronize_rcu_full(9)rcu_barrier(9)rcu_barrier_throttled(9)
๐ that's the page!! this one came from./kernel/rcu, datedOctober 2026, and it'scall_rcu(9)from theKernel API Manualโ go queue a callback and slay, bestie ๐โจ๐
๐ฆ 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