raw_atomic64..._sub_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic64..._sub_acquire(9) β€” Kernel API Manual

okay so bestie, welcome to the Kernel API Manual, section 9 (that's the kernel-API shelf, iykyk) πŸ’– today's main character is raw_atomic64_fetch_sub_acquire, and yeah the header does that whole raw_atomic64..._sub_acquire(9) abbreviating thing β€” truncated but iconic, we love a mysterious queen. hydrate and let's go ✨


🌸 NAME 🌸

raw_atomic64_fetch_sub_acquire β€” atomic subtract with acquire ordering πŸŽ€ that's it, that's the whole vibe.

✨ SYNOPSIS ✨

s64 raw_atomic64_fetch_sub_acquire (s64 i , atomic64_t *v );

literally just two little arguments and a s64 coming back out. no drama. 🫢

πŸ¦‹ ARGUMENTS πŸ¦‹

  • i β€” an s64, and it's the value to subtract. the amount getting yeeted. πŸ’…
  • v β€” pointer to atomic64_t. the actual thing being updated. the one holding the number.

πŸŽ€ DESCRIPTION πŸŽ€

So what happens is: it atomically updates v to (v - i) with acquire ordering. atomically means nobody can catch it mid-subtraction β€” it's a whole thing or nothing, no in-between, no crumbs πŸ’€ and the acquire ordering part is right there in the name so you already knew.

πŸ’– real talk bestie: Safe to use in noinstr code β€” but prefer atomic64_fetch_sub_acquire elsewhere. that's the assignment. raw_ is the noinstru-ment, everything else gets the regular one. no cap.

πŸ”₯ RETURN πŸ”₯

The original value of v β€” like, the value from before the subtraction, bestie. that's the whole point of the fetch_ prefix, it hands you the old number while it updates the thing. 😭

🌈 SEE ALSO 🌈

the lore lives in the kernel file <./include/linux/atomic/atomic-arch-fallback.h> πŸ‘‘ and here's the entire friend group β€” everyone invited, nobody left out, fr fr:


okay that's the whole page, you ate that πŸ“ source of this little masterpiece is <./include/linux/atomic>, dated October 2026, and it's filed under raw_atomic64..._sub_acquire(9) β€” go forth and subtract atomically, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from