raw_atomic_long_add_unless(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_long_add_unless

okay so bestie, welcome to the Kernel API Manual ✨ β€” this is the page for raw_atomic_long_add_unless, and it's literally the "add, but only if you're not matching this one value" girlie. full ordering included, no cap.


🌸 NAME 🌸

raw_atomic_long_add_unless β€” atomic add unless value with full ordering πŸŽ€


✨ SYNOPSIS ✨

bool raw_atomic_long_add_unless (atomic_long_t *v , long a , long u );

🧚 ARGUMENTS 🧚

  • v β€” pointer to atomic_long_t. she's the main character, the thing getting updated πŸ’–
  • a β€” a long value to add. this is the amount going in, bestie
  • u β€” a long value to compare with. the vibe check value, if you will πŸ¦‹

πŸ”₯ DESCRIPTION πŸ”₯

So here's the tea 🍡 β€” if (v != u), then it atomically updates v to (v + a) with full ordering. iconic behavior, truly.

Otherwise β€” like, if v does equal u* β€” then v` is not modified and you get relaxed ordering instead. she simply didn't feel like it that day πŸ’€

Safe to use in noinstr code 🫢 but prefer atomic_long_add_unless everywhere else, okay? iykyk.

ngl the "safe in noinstr" thing is real and the "prefer atomic_long_add_unless elsewhere" thing is also real β€” don't come for me, that's just what the page says πŸ™ˆ

πŸ‘‘ RETURN πŸ‘‘

true if v was updated, false otherwise. that's it, that's the whole mood ⭐


🌈 SEE ALSO 🌈

Kernel file ./include/linux/atomic/atomic-long.h β€” go read it, she's thorough πŸ’œ

and now, the whole friend group 😭 look at all these siblings:


and that's the whole page bestie, you ate that πŸ’…βœ¨

source file: ./include/linux/atomic Β· dated October 2026 Β· Kernel API Manual β€” mwah, go forth and be atomic πŸ«ΆπŸŽ€πŸ’–

πŸ“¦ where this page comes from