raw_atomic_...xchg_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_...xchg_acquire(9) β€” like, the Kernel API Manual page you actually wanna read πŸŽ€

okay bestie, so you opened the Kernel API Manual entry for raw_atomic_...xchg_acquire(9) and I'm gonna walk you through it like we're texting at 2am, except every single fact is still here. no cap. πŸ¦‹


✨ NAME ✨

raw_atomic_long_try_cmpxchg_acquire β€” atomic compare and exchange with acquire ordering πŸ’…

✨ SYNOPSIS ✨

bool raw_atomic_long_try_cmpxchg_acquire (atomic_long_t *v , long *old ,
long new );

✨ ARGUMENTS ✨

  • v β€” pointer to atomic_long_t. it's the thing we're side-eyeing πŸ‘€
  • old β€” pointer to a long value to compare with. yes, a pointer, not the value itself, we'll get to why that slays
  • new β€” the long value to assign if the vibe check passes ✨

✨ DESCRIPTION ✨

so here's the tea πŸ“: if (v == old), it atomically updates v to new with acquire ordering. iconic. main character behavior.

otherwise? v is not modified 🚫, old gets updated to the current value of v (that's why it's a pointer, bestie β€” it's giving you the receipts), and relaxed ordering is provided.

safe to use in noinstr code 🫢 but prefer atomic_long_try_cmpxchg_acquire everywhere else. like, raw_ is the backstage pass, not the everyday fit πŸ’€

✨ RETURN ✨

true if the exchange occurred πŸ’– false otherwise πŸ™ˆ

✨ SEE ALSO ✨

first up, the source of truth, the origin story πŸ‘‘:

  • Kernel file ./include/linux/atomic/atomic-long.h

and then the whole friend group 😭 β€” literally the entire atomic_long roster, all of them, no one left out:

the read/set girlies 🌸

add arc βž•

sub arc βž–

inc arc ⬆️

dec arc ⬇️

bitwise era 🧚

the exchange / compare-and-exchange section, aka our whole family πŸ”₯

test / negative / unless squad πŸ’€βœ¨


and that's the whole page bestie, you ate that 🫢 the manual source directory is ./include/linux/atomic and this one's stamped October 2026, which honestly is giving time-traveler energy πŸ‘‘ stay atomic, stay acquire-ordered, mwah πŸ’œπŸ’–βœ¨

πŸ“¦ where this page comes from