cond_synchronize_rcu(9)
π cond_synchronize_rcu(9) π
okay bestie, welcome to the Kernel API Manual β this one's cond_synchronize_rcu, and it's literally the "wait for an RCU grace period, but only if you have to" girlie. conditional queen behavior, we stan π
β¨ NAME β¨
cond_synchronize_rcu β conditionally wait for an RCU grace period π¦
πΈ SYNOPSIS πΈ
void cond_synchronize_rcu (unsigned long oldstate );
π ARGUMENTS π
oldstateβ the value you got back fromget_state_synchronize_rcu,start_poll_synchronize_rcu, orstart_poll_synchronize_rcu_expedited. like, it's the receipt from your earlier call, keep it safe π
π DESCRIPTION π
so here's the vibe check π: if a full RCU grace period has already elapsed since that earlier call to get_state_synchronize_rcu or start_poll_synchronize_rcu, then this function just returns. nothing to do, no waiting, we're done, slay β¨
otherwise? it invokes synchronize_rcu and actually waits for a full grace period. no cap, sometimes you gotta wait π
yes, this function does not take counter wrap into account. but bestie β counter wrap is harmless π. if the counter wraps, we've waited for more than 2 billion grace periods (and way more on a 64-bit system!), so waiting for a couple of additional grace periods should be just fine. like genuinely, it's giving "not a problem" π
okay and this part is highkey important: this function provides the same memory-ordering guarantees that would be provided by a synchronize_rcu that was invoked at the call to the function that provided oldstate and that returned at the end of this function. periodt π₯
π 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)call_rcu(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_full(9)rcu_barrier(9)rcu_barrier_throttled(9)
and that's the whole page, bestie π«Ά this lil icon lives in ./kernel/rcu and the version/date stamp on it says October 2026 β so go forth, wait conditionally, and remember: the counter wrap cannot hurt you π§π
π¦ 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