atomic_long..._sub_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… atomic_long_fetch_sub_acquire β€” from the Kernel API Manual, section 9, bestie πŸŽ€

okay so you opened the Kernel API Manual and landed on atomic_long_fetch_sub_acquire, and honestly? iconic choice. this is the atomic subtract situation, acquire-flavoured, and i'm gonna walk you through it like we're texting at 2am. πŸ¦‹


✨ NAME ✨

atomic_long_fetch_sub_acquire β€” atomic subtract with acquire ordering. that's it, that's the whole vibe. πŸ’–


🌸 SYNOPSIS 🌸

long atomic_long_fetch_sub_acquire (long i , atomic_long_t *v );

look at her. two args, returns a long, does exactly one thing. main character energy. πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” a long value, and it's the amount you're subtracting. like, the thing getting taken away. πŸ“
  • v β€” pointer to your atomic_long_t. this is the one being updated, so be nice to her.

πŸ’… DESCRIPTION πŸ’…

okay so the whole bit: it atomically updates v to (v - i) with acquire ordering. atomically means nobody can sneak a peek at a half-done state, and acquire ordering is the memory-ordering flavour you're getting. no cap. ⭐

⚠️ real talk though β€” unsafe to use in noinstr code. if you're in noinstr, use raw_atomic_long_fetch_sub_acquire there instead. do not ignore this, i'm literally begging. 😭

πŸ”₯ RETURN πŸ”₯

the original value of v. so like, the value from before the subtract happened. she remembers what she was. πŸ™ˆ


🌈 SEE ALSO 🌈

these are all chillin' in the kernel file ./include/linux/atomic/atomic-instrumented.h, and yes there are a LOT of them, buckle up bestie πŸ’€

and now the 64-bit girlies 🧚

aaaand the long crew, aka our own family 🫢


and that's the whole page, bestie, you ate it πŸ’œ this cutie came out of ./include/linux/atomic, dated October 2026, and she's filed as atomic_long..._sub_acquire(9) β€” go forth and subtract atomically, mwah 🧚✨🌸

πŸ“¦ where this page comes from