raw_atomic64_inc_not_zero(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– raw_atomic64_inc_not_zero(9) β€” Kernel API Manual, but make it make sense πŸ’…

okay so bestie, welcome to the raw_atomic64_inc_not_zero(9) page from the Kernel API Manual, and it’s giving one tiny conditional atomic increment with full ordering and zero cap ✨


πŸŽ€ NAME πŸŽ€

raw_atomic64_inc_not_zero β€” atomic increment unless zero with full ordering πŸ’–

✨ SYNOPSIS ✨

bool raw_atomic64_inc_not_zero (atomic64_t *v );

🫢 ARGUMENTS 🫢

  • v β€” pointer to atomic64_t. that’s the whole cast, bestie 🫢

πŸ”₯ DESCRIPTION πŸ”₯

If (v != 0), atomically updates v to (v + 1) with full ordering. Otherwise, v is not modified and relaxed ordering is provided.

Safe to use in noinstr code; prefer atomic64_inc_not_zero elsewhere.

so like, if your atomic64 is not zero, it gets the +1 treatment atomically and with full ordering. if it is zero, hands off β€” v is not modified, and you get relaxed ordering. and yes, it’s safe in noinstr code, but anywhere else the preferred slay is atomic64_inc_not_zero πŸ‘‘

πŸ’– RETURN πŸ’–

true if v was updated, false otherwise.

cute boolean, no surprises, no drama 🌸

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file: ./include/linux/atomic/atomic-arch-fallback.h

the whole raw atomic extended fam, no skips, no cap:


cute sign-off bestie: source/version is ./include/linux/atomic, date is October 2026, and the page is raw_atomic64_inc_not_zero(9) β€” go slay your atomics, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from