raw_atomic64..._xor_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 raw_atomic64..._xor_relaxed (9) β€” Kernel API Manual, bestie edition 🌸

okay so you found the page for raw_atomic64..._xor_relaxed(9) in the Kernel API Manual and honestly? you're about to learn the chillest, most no-thoughts-just-vibes way to XOR a 64-bit atomic. let's go πŸ’…


✨ NAME ✨

raw_atomic64_fetch_xor_relaxed β€” atomic bitwise XOR with relaxed ordering πŸ¦‹

like, it flips bits and it does not stress about memory ordering. she's lowkey unbothered. periodt.


✨ SYNOPSIS ✨

s64 raw_atomic64_fetch_xor_relaxed (s64 i , atomic64_t *v );

that's the whole vibe check β€” one value, one pointer, no drama πŸŽ€


✨ ARGUMENTS ✨

  • i β€” an s64 value. yes bestie, that's the thing you're XOR-ing in πŸ”₯
  • v β€” pointer to atomic64_t. this is the main character that's actually getting mutated πŸ‘‘

✨ DESCRIPTION ✨

Atomically updates v to (v ^ i) with relaxed ordering. 🧚

that's it. that's the whole function. she XORs, she commits, she moves on. no fences, no extra ceremony, just raw atomic behavior.

it's safe to use in noinstr code β€” that's her whole flex πŸ’– β€” but the manpage is very clear: prefer atomic64_fetch_xor_relaxed elsewhere. so like, raw_ is for the special noinstr situations, otherwise use the normal one, iykyk.

🌈 quick recap of the rule: noinstr code? yes, use raw_atomic64_fetch_xor_relaxed. every other place? use atomic64_fetch_xor_relaxed. don't be out here doing the wrong one for the aesthetic 😭

✨ RETURN ✨

the original value of v β€” aka the value it had before the XOR happened. she tells you where she's been, not where she's going ⭐


✨ SEE ALSO ✨

the kernel file that lives at ./include/linux/atomic/atomic-arch-fallback.h 🫢 and like… the entire extended friend group of atomic helpers. every single one, no skips, bestie πŸ’€


and that's the page, bestie 🫢 source lives at ./include/linux/atomic, dated October 2026, and the whole thing came out of the Kernel API Manual β€” so go forth, XOR ur 64-bit atomics, and remember: relaxed ordering, noinstr only, prefer the non-raw_ version everywhere else. slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from