atomic64_inc...ess_negative(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic64_inc...ess_negative(9) β€” Kernel API Manual, but make it make sense

okay so bestie, you found the page for atomic64_inc_unless_negative in the Kernel API Manual (that's the manual name btw, written as atomic64_inc...ess_negative(9) up top β€” yes the header truncates it, that's just how it vibes πŸ’€). Anyway. It's giving "increment, but only if things are chill." Let's get into it πŸŽ€


✨ NAME ✨

atomic64_inc_unless_negative β€” atomic increment unless negative with full ordering πŸ”₯

πŸ¦‹ SYNOPSIS πŸ¦‹

bool atomic64_inc_unless_negative (atomic64_t *v );

🌸 ARGUMENTS 🌸

  • v β€” pointer to atomic64_t. that's it. that's the whole argument. she's low maintenance πŸ’…

πŸ’– DESCRIPTION πŸ’–

Okay so here's the tea πŸ“ β€” if (v >= 0), it atomically updates v to (v + 1) with full ordering. Slay, the number goes up, and everybody sees it happen in the right order ✨

Otherwise β€” like if v is negative β€” v is not modified at all, and relaxed ordering is provided. She said "no thank you" and stayed exactly where she was πŸ™ˆ

⚠️ real talk: Unsafe to use in noinstr code. Use raw_atomic64_inc_unless_negative there instead. no cap, that's the whole warning, don't skip it πŸ’€

πŸ‘‘ RETURN πŸ‘‘

  • true if v was updated πŸ’–
  • false otherwise 🫢

🌈 SEE ALSO 🌈

Kernel file ./include/linux/atomic/atomic-instrumented.h β€” and bestie, the guest list here is iconic, it's basically the entire atomic family reunion. everybody showed up πŸ‘‘

the atomic_* girlies:

the 64-bit edition (our main character's squad πŸ’œ):

the long-haul crew (atomic_long_*, they've been through it 😭):


and that's the whole page, bestie 🫢 it shipped from ./include/linux/atomic dated October 2026, still filed under atomic64_inc...ess_negative(9). go forth and increment responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from