atomic64_cmpxchg_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic64_cmpxchg_release β€” straight from the Kernel API Manual, section 9 ✨

okay so bestie, welcome to the glow-up corner of the kernel docs where we talk about everyone's favorite "did it actually match tho" atomic operation πŸŽ€ this one's called atomic64_cmpxchg_release and it's giving main character energy in the 64-bit compare-and-swap cinematic universe πŸ’–


🌸 NAME 🌸

atomic64_cmpxchg_release β€” atomic compare and exchange with release ordering πŸ”₯


✨ SYNOPSIS ✨

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

🫢 ARGUMENTS 🫢

  • v β€” pointer to atomic64_t πŸ’« (this is the thing we're side-eyeing)
  • old β€” s64 value to compare with πŸ‘€ (the vibe check target)
  • new β€” s64 value to assign 🎁 (the glow-up replacement)

πŸ’€ DESCRIPTION πŸ’€

so here's the tea: if (v == old), it atomically updates v to new with release ordering πŸ¦‹. love that for us.

Otherwise, v is not modified and relaxed ordering is provided πŸ™ˆ β€” like, no changes, we just move on, no cap.

⚠️ Unsafe to use in noinstr code; use raw_atomic64_cmpxchg_release there. fr fr, don't do it in noinstr code, she said what she said πŸ’…

πŸ‘‘ RETURN πŸ‘‘

The original value of v 🌈 β€” yes, the original, like a before pic πŸ“Έ


🧚 SEE ALSO 🧚

literally the whole extended friend group, all from the kernel file ./include/linux/atomic/atomic-instrumented.h πŸ’œ

πŸ“ the atomic_* girlies

πŸ¦‹ the atomic64_* icons (our girl's home turf)

🌈 the atomic_long_* cousins


okay that's the whole page bestie, go be atomic out there πŸ”₯🫢

source: ./include/linux/atomic Β· date: October 2026 Β· mwah, that's the sign-off, ty for coming to my ted talk πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from