cond_synchronize_rcu_full(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 from get_state_synchronize_rcu_full, start_poll_synchronize_rcu_full, or start_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:


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