raw_atomic_xor(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 raw_atomic_xor πŸ’…

okay so bestie, this is a page from the Kernel API Manual, section 9 β€” yes, kernel land, we're literally in the driver-adjacent part of the filesystem. sit down, hydrate, let's go 🫢


✨ NAME ✨

raw_atomic_xor β€” atomic bitwise XOR, but make it relaxed ordering. no cap, that's the whole vibe.


πŸ¦‹ SYNOPSIS πŸ¦‹

void raw_atomic_xor (int i , atomic_t *v );

that's it. that's the whole signature. she's small but she's mighty 😭


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” an int value. your little XOR buddy, the thing you're bringing to the party.
  • v β€” pointer to atomic_t. this is the main character of the operation, and yes she's a pointer, treat her with respect πŸ‘‘

🌈 DESCRIPTION 🌈

so what happens is: v gets atomically updated to (v ^ i) β€” like, all in one go, nobody can sneak in halfway β€” and the ordering is relaxed. think chill, lowkey, no unnecessary fences in the way ⭐

it's also safe to use in noinstr code β€” iconic behavior, honestly πŸ’€ but outside of that, bestie, prefer atomic_xor elsewhere. that's the recommendation, take it πŸ™ˆ


πŸ’– RETURN πŸ’–

Nothing. nothing at all. she gives nothing back, she simply does the thing. it's giving mysterious, it's giving void πŸŽ€


πŸ”₯ SEE ALSO πŸ”₯

first up, the kernel file: ./include/linux/atomic/atomic-arch-fallback.h β€” that's where the magic lives.

and then... okay, buckle up, because this list is long and every single one of these is getting her moment. no skipping, i promised πŸ’…

like, that's the whole extended family. the 32-bit girlies AND the 64-bit girlies. we love a supportive family tree πŸŒ³πŸ’œ


that's the page, bestie!! and because we always credit our sources: this one's from the kernel source dir ./include/linux/atomic, dated October 2026, and she lives on page raw_atomic_xor(9). mwah πŸ’‹βœ¨ go xor something, safely 🫢

πŸ“¦ where this page comes from