atomic64_try...xchg_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic64_try_cmpxchg_acquire(9) β€” Kernel API Manual ✨

okay bestie, welcome to section 9 of the Kernel API Manual, where we stan one (1) very specific atomic compare-and-swap and honestly? she eats. πŸ“


🌸 NAME 🌸

atomic64_try_cmpxchg_acquire β€” atomic compare and exchange with acquire ordering πŸŽ€


✨ SYNOPSIS ✨

bool atomic64_try_cmpxchg_acquire (atomic64_t *v , s64 *old , s64 new );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • v β€” pointer to atomic64_t. this is the main character, the thing we're trying to swap out πŸ‘‘
  • old β€” pointer to the s64 value to compare with. literally the "are you the one?" checkpoint πŸ’…
  • new β€” the s64 value to assign. the glow-up we're swapping in 🌈

πŸ’– DESCRIPTION πŸ’–

so here's the vibe: if (v == old), the kernel atomically updates v to new with acquire ordering. slay. ✨

otherwise (and this is the important part, don't skip it) v is not modified, old gets updated to the current value of v, and relaxed ordering is provided. no cap, that's the whole deal. 🫢

⚠️ okay so this one is unsafe to use in noinstr code β€” use raw_atomic64_try_cmpxchg_acquire there instead. iykyk, please don't come for me if you ignore this πŸ™ˆ

πŸ’€ RETURN πŸ’€

true if the exchange occurred, false otherwise. that's it, that's the return. simple queen behaviour πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

first up, the source file so you can go read the real thing:

Kernel file ./include/linux/atomic/atomic-instrumented.h

and now the extended family β€” every single one of these (9) pages, no skips, no cuts, we're doing the whole group chat 🧚

🩷 the atomic_* girlies

πŸŽ€ the atomic64_* besties (our girl's home turf)

πŸ¦‹ the atomic_long_* cousins


and that's the whole page, bestie 🫢 this one came from ./include/linux/atomic, dated October 2026, and it's filed under atomic64_try...xchg_acquire(9) β€” mwah, go atomically exchange something responsibly πŸ’œβ­

πŸ“¦ where this page comes from