raw_atomic6...turn_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

raw_atomic64_add_return_relaxed β€” atomic add, but make it chill (relaxed ordering, bestie)

okay so first things first, this lil page lives in the Kernel API Manual, and the star of the show is raw_atomic64_add_return_relaxed(9). She's a 64-bit atomic add that hands you back the shiny new value. That's the whole vibe. πŸ’–


✨ SYNOPSIS ✨

s64 raw_atomic64_add_return_relaxed (s64 i , atomic64_t *v );

like, that's it. two args, one dream. πŸŽ€


🫢 ARGUMENTS 🫢

  • i β€” the s64 value you're adding. your contribution. your little gift to the counter. ✨
  • v β€” pointer to atomic64_t. this is the thing getting updated, no cap.

🌸 DESCRIPTION 🌸

So here's the tea: this function atomically updates v to (v + i), and it does it with relaxed ordering. Atomic means nobody else gets to sneak in halfway through β€” the whole add goes down as one indivisible moment. Relaxed ordering means we're not putting up extra memory-barrier fences around it. Chill. Lowkey effortless. πŸ’…

It's safe to use in noinstr code β€” that's her whole superpower, iykyk. But everywhere else, the manpage says to prefer atomic64_add_return_relaxed instead. So like, this one's for the special noinstr occasions. 🧚

literally do not sleep on that preference note β€” outside noinstr code, the non-raw_ version is the one you want. πŸ”₯

πŸ‘‘ RETURN πŸ‘‘

The updated value of v. That's it. You add, she gives you back the aftermath β€” the fresh new number. (v + i), delivered straight to your face. πŸ“


πŸ¦‹ SEE ALSO πŸ¦‹

Bestie there is a WHOLE ENTIRE FAMILY here and I'm obsessed, so buckle up. First, the kernel file she lives in:

  • Kernel file ./include/linux/atomic/atomic-arch-fallback.h

and now, the squad, in the exact order the manpage lists them:

β€”β€”

okay and now the 64-bit girlies, which is our girl's actual friend group:

like. the whole tree. she's connected. 🌈


mwah, that's the page! πŸ’œ this icon is filed under ./include/linux/atomic, dated October 2026, and yes she really did eat, no crumbs left. go forth and add atomically, bestie β€” and remember to source her from the Kernel API Manual when you cite her. 🫢✨

πŸ“¦ where this page comes from