raw_atomic_t...xchg_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

raw_atomic_try_cmpxchg_release β€” it's the atomic compare-and-exchange function, but make it release-ordering ✨ (this is page 9 of the Kernel API Manual, bestie, so you know it's a real one 🫢)


🌸 SYNOPSIS 🌸

bool raw_atomic_try_cmpxchg_release (atomic_t *v , int *old , int new );

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” a pointer to atomic_t. this is the thing we're messing with, the main character of the whole operation πŸ‘‘
  • old β€” a pointer to the int value we're comparing against. note that it's a pointer, bestie, she does double duty (more on that below πŸ‘€)
  • new β€” the int value to assign. the new era πŸ’«

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the vibe check. if (v == old), the function atomically updates v to new with release ordering. slay, exchange happened πŸ’…

but if that's not the case? then v is not modified at all β€” she said "no thank you" β€” and instead old gets updated to the current value of v, and relaxed ordering is provided. so old walks away holding the real answer. that's the plot twist, iykyk 😭

it's safe to use in noinstr code β€” but fr fr, prefer atomic_try_cmpxchg_release everywhere else. the raw_ version is the low-level one, it's giving "built different, use with intention" energy πŸ’€

⭐ RETURN ⭐

true if the exchange occurred, false otherwise. that's it, that's the whole personality 🌈


πŸ’– SEE ALSO πŸ’–

lowkey the biggest friend group in the whole kernel, no cap. here's everyone:


that's the whole page, bestie 🫢 go forth and compare-and-exchange responsibly πŸ’œ

this icon lives in ./include/linux/atomic, dated October 2026, and the header up top calls her raw_atomic_t...xchg_release(9) (the name got truncated mid-vibe, we don't gatekeep, we love her anyway πŸ’€βœ¨)

πŸ“¦ where this page comes from