atomic64_cmpxchg_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic64_cmpxchg_acquire β€” from the Kernel API Manual, section 9

okay so bestie, welcome to atomic64_cmpxchg_acquire(9) β€” yes that's the whole title, yes it's a mouthful, and yes it's from the Kernel API Manual. section 9. iconic behavior. let's get into it 🫢


✨ NAME ✨

atomic64_cmpxchg_acquire β€” it's an atomic compare and exchange, but make it acquire ordering. like, the vibes are ordered. memory-ordering ordered, specifically 🌸


πŸŽ€ SYNOPSIS πŸŽ€

s64 atomic64_cmpxchg_acquire (atomic64_t *v , s64 old , s64 new );

that's the whole signature. three args, one s64 coming back at you. slay.


🌈 ARGUMENTS 🌈

  • v β€” pointer to atomic64_t. it's giving "here's the thing we're about to mess with" energy πŸ‘‘
  • old β€” the s64 value to compare with. the vibe check value, if you will πŸ’…
  • new β€” the s64 value to assign. what v becomes if it passes the vibe check ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: if (v == old), it atomically updates v to new with acquire ordering. otherwise, v is not modified and relaxed ordering is provided. no cap, that's the whole deal β€” the ordering you get depends on whether the swap actually happened. the way that's lowkey elegant 😭

⚠️ unsafe to use in noinstr code β€” use raw_atomic64_cmpxchg_acquire there instead. fr fr, do not skip this one, it's a real warning, not a vibe πŸ’€

πŸ”₯ RETURN πŸ”₯

the original value of v. that's it. that's the return. you always find out what was there before πŸ“


πŸ‘‘ SEE ALSO πŸ‘‘

okay so this is the part where I tell you there are a lot of friends. like, an unreasonable number of friends. all of these live in the kernel file ./include/linux/atomic/atomic-instrumented.h 🧚 and every single one of them is a real page, so:

that's all of them. I counted. twice. go read some, iykyk πŸ’œ


<div align="center">🌸 🌸 🌸</div>

and that's the page, bestie!! this little beauty ships from ./include/linux/atomic, dated October 2026 β€” so yeah, mark your calendar, it's giving futuristic. mwah, go forth and compare-and-exchange responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from