raw_atomic_i...ess_negative(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

Okay bestie, this is the raw_atomic_i...ess_negative(9) page from the Kernel API Manual β€” yes, the title is literally truncated like that, it's giving mysterious cliffhanger energy, but the function is raw_atomic_inc_unless_negative: the atomic increment-unless-negative with full ordering. πŸ’…

✨ SYNOPSIS ✨

bool raw_atomic_inc_unless_negative (atomic_t *v );

πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_t. That's the counter cutie we're checking and maybe bumping. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: if v >= 0, this atomically updates v to v + 1 with full ordering. If v is negative, v does not get modified, and you get relaxed ordering instead. No cap. ✨

It's safe to use in noinstr code β€” but bestie, everywhere else you should prefer atomic_inc_unless_negative. That's the rule. πŸ’–

πŸ’– RETURN πŸ’–

  • true if v was updated.
  • false otherwise.

Simple as that, bestie. βœ…

🌈 SEE ALSO 🌈

Kernel file: ./include/linux/atomic/atomic-arch-fallback.h β€” that's the spot. πŸ‘‘

The whole raw atomic family, bestie:


Source: ./include/linux/atomic β€’ Version/manual: Kernel API Manual β€’ Date: October 2026 β€’ Page: raw_atomic_i...ess_negative(9). That's the whole page, bestie β€” go atomically increment responsibly! πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from