raw_atomic_add_unless(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ raw_atomic_add_unless(9) ✨

okay so bestie, welcome to the Kernel API Manual πŸ’– this one's a lil kernel-page deep-cut, and honestly? it's giving "the friend who only shows up when the vibe check passes." let's get into it πŸ¦‹


🌸 NAME 🌸

raw_atomic_add_unless β€” atomic add unless value, with full ordering πŸ’…

like, it adds... but only if you're not the value it's avoiding. conditional queen behavior πŸ‘‘


⭐ SYNOPSIS ⭐

bool raw_atomic_add_unless (atomic_t *v , int a , int u );

that's it. that's the whole signature. short, sweet, and absolutely not to be messed with πŸ”₯


πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_t ✨ (this is the thing getting updated, the main character of the operation)
  • a β€” int value to add πŸ“ (the little gift you're adding in)
  • u β€” int value to compare with 🧚 (the "unless" part β€” if v is this, we don't do the thing)

πŸ’œ DESCRIPTION πŸ’œ

so here's the tea β˜• β€” if (v != u), it atomically updates v to (v + a) with full ordering. full ordering, bestie, we're not playing games here πŸ”₯

otherwise (meaning v is u), v is not modified at all, and relaxed ordering is provided. so like, nothing happens, but it happens in a chill way πŸ’…

it's safe to use in noinstr code 🫢 β€” but the manual says prefer atomic_add_unless elsewhere. so like, it's the special-occasion version, not your everyday grab-and-go. iykyk πŸ™ˆ

🌈 RETURN 🌈

  • true if v was updated βœ…
  • false otherwise ❌

that's the whole vibe check, no cap πŸ’―


πŸ‘‘ SEE ALSO πŸ‘‘

kernel file πŸ“ ./include/linux/atomic/atomic-arch-fallback.h

and now, the moment you've all been waiting for... the entire friend group 😭 (yes, all of them. i counted. there are SO many. not skipping a single one, that would be disrespectful πŸ™):

like i said. HUGE friend group. every single one of them made the list πŸ’€ but honestly? iconic. no notes. πŸ‘‘


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

this lil beauty lives at ./include/linux/atomic β€” dated October 2026 β€” and goes by raw_atomic_add_unless(9). mwah, go forth and be atomic πŸ«ΆπŸ’–

πŸ“¦ where this page comes from