raw_atomic_...xchg_release(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so welcome to the Kernel API Manual, bestie πŸ’– β€” this page is filed under raw_atomic_...xchg_release(9) and it's all about raw_atomic_long_try_cmpxchg_release: atomic compare and exchange with release ordering. It's giving "try the compare-exchange, but make it release-flavored." No cap. ✨

✨ SYNOPSIS ✨

copy this exactly, spaces and all:

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

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_long_t. This is the atomic long getting the main character treatment πŸ‘‘.
  • old β€” pointer to long value to compare with. The "is it this one?" pointer, basically.
  • new β€” long value to assign. The new value waiting in the wings πŸ’….

πŸ’… DESCRIPTION πŸ’…

If (v == old), it atomically updates v to new with release ordering. Slay. Otherwise, v is not modified, old is updated to the current value of v, and relaxed ordering is provided. That's the tea β˜•.

Heads up, bestie: it's safe to use in noinstr code 🫢. But elsewhere, prefer atomic_long_try_cmpxchg_release. Periodt.

πŸ”₯ RETURN πŸ”₯

Returns true if the exchange occurred, and false otherwise. The bool is booling, fr fr. 😌

πŸ¦‹ SEE ALSO πŸ¦‹

Kernel file: ./include/linux/atomic/atomic-long.h β€” the source of truth, go read it.

Mwah πŸ’‹ β€” source/version: ./include/linux/atomic, dated October 2026. Bye bestie, go atomically slay. 🌈

πŸ“¦ where this page comes from