raw_atomic6...tive_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic64_add_negative_relaxed πŸ’…

ok so welcome to the Kernel API Manual bestie, and today's main character is raw_atomic64_add_negative_relaxed β€” the lowercase-regex-looking name is literally just how the page header squishes it (raw_atomic6...tive_relaxed(9)), do not let that jump-scare you πŸ’€


✨ NAME ✨

raw_atomic64_add_negative_relaxed β€” atomic add and test if negative, with relaxed ordering πŸŽ€

Like, you add a thing, and then you check if the result went negative. Atomically. With relaxed ordering. That's the whole vibe ✨


🌸 SYNOPSIS 🌸

bool raw_atomic64_add_negative_relaxed (s64 i , atomic64_t *v );

Yup, that spacing is canon, copy it exactly 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” an s64 value to add πŸ’– that's the number going in
  • v β€” pointer to atomic64_t πŸ‘‘ that's the thing getting updated

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea: it atomically updates v to (v + i) with relaxed ordering.

That's it. That's the function. Add, and it's relaxed about memory ordering the way I'm relaxed about my sleep schedule 😭

It's safe to use in noinstr code β€” which is a mood, honestly. But elsewhere, prefer atomic64_add_negative_relaxed instead. That's not me being shady, that's literally what the page says 🫢

ngl, if you're not in noinstr territory, use the non-raw_ version β€” the raw one is for the special cases, iykyk πŸ’…

🌈 RETURN 🌈

Returns true if the resulting value of v is negative, false otherwise ✨

Literally a vibe check on your number: negative = true, not negative = false πŸ¦‹


πŸ’œ SEE ALSO πŸ’œ

Kernel file: ./include/linux/atomic/atomic-arch-fallback.h πŸ“

ok this list is long long, but every single one is here because we do not skip entries in this house πŸ‘‘

ok that's the whole fam, all accounted for, no crumbs left behind 🧚


and that's the page!! ty for coming to my ted talk 🫢 this one lives in ./include/linux/atomic and it's dated October 2026 β€” slay, see u next time bestie πŸ’–βœ¨

πŸ“¦ where this page comes from