cond_synchronize_rcu_full(9)
π cond_synchronize_rcu_full β the "wait for an RCU grace period, but like, only if you actually have to" girlies' guide
okay so this is a page from the Kernel API Manual, and bestie, it's a little function with a big job and honestly zero drama. let's get into it β¨
β¨ NAME β¨
cond_synchronize_rcu_full β conditionally wait for an RCU grace period. conditional queen behavior, we love to see it π
π¦ SYNOPSIS π¦
void cond_synchronize_rcu_full (struct rcu_gp_seq *gsp );
that's it. that's the whole signature. no cap, she's tiny π
π ARGUMENTS π
gspβ this is the value you got back fromget_state_synchronize_rcu_full,start_poll_synchronize_rcu_full, orstart_poll_synchronize_rcu_expedited_full. like, it's the little receipt those functions handed you. don't lose it, don't make up your own, just pass the one you got π§Ύβ¨
πΈ DESCRIPTION πΈ
okay so here's the vibe check: if a full RCU grace period has already elapsed since you called get_state_synchronize_rcu_full, start_poll_synchronize_rcu_full, or start_poll_synchronize_rcu_expedited_full β the very call that gave you gsp β then this function literally just returns. nothing happens. you're free. go live your life π¦π¨
otherwise? she invokes synchronize_rcu and waits for a full grace period. so it's like, "already done? slay. not done? okay we wait." main character energy with a backup plan π
now listen, bestie, because this is the part where you don't come for her: yes, this function does not take counter wrap into account. that's a real thing she does. but counter wrap is harmless, so it's fine, periodt. if the counter wraps, we've already 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. 2 billion. TWO BILLION. that's not a typo, that's just the lore ππ₯
and the memory-ordering tea π΅: 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 gsp and that returned at the end of this function. like, identical guarantees, no substitutions, iykyk π
π SEE ALSO π
the whole friend group, in the order the kernel file gives them:
- Kernel file
./kernel/rcu/tree.c 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(9)rcu_barrier(9)rcu_barrier_throttled(9)
fr fr, go read the whole squad. they're all in ./kernel/rcu/tree.c and they all ate π«Άπ₯
and that's the page, bestie!! this one comes from the source ./kernel/rcu and it's dated October 2026 β so like, mark your calendars, she's timestamped and everything. πβ¨π bye!! π¦
π¦ 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