atomic_fetch_dec_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 atomic_fetch_dec_acquire β€” atomic decrement with acquire ordering ✨

okay so bestie, this is atomic_fetch_dec_acquire(9) from the Kernel API Manual, section 9, and it is exactly what it says on the tin: it decrements a thing atomically, and the whole operation is acquire-ordered. Genuinely iconic kernel behavior, no notes πŸ’…


πŸŽ€ NAME

atomic_fetch_dec_acquire β€” atomic decrement with acquire ordering


πŸ¦‹ SYNOPSIS

int atomic_fetch_dec_acquire (atomic_t *v );

πŸ’– ARGUMENTS

  • v β€” pointer to atomic_t. that's it. that's the whole argument list, she's low-maintenance like that 🫢

✨ DESCRIPTION

So like β€” this one atomically updates v to (v - 1) with acquire ordering. Translation for the girlies: the subtraction happens all at once (nobody can catch it mid-decrement πŸ™ˆ), and the acquire ordering means the memory semantics come with it. It's giving "I decrement AND I order memory, multitasking queen" πŸ‘‘

⚠️ Unsafe to use in noinstr code β€” use raw_atomic_fetch_dec_acquire there instead. fr fr, do not come for me if you ignore this one πŸ’€

🌈 RETURN

The original value of v. not the new one!! the original one!! the value from before the decrement, bestie. this is the whole reason the function has "fetch" in its name 😭


πŸ‘‘ SEE ALSO

Kernel file ./include/linux/atomic/atomic-instrumented.h, plus the entire extended universe of atomic friends (this list is long, hydrate first πŸ“):


and that's the whole page, bestie!! πŸŽ€ this cutie lives in the kernel source at ./include/linux/atomic, and this rendition is dated October 2026 β€” mwah, see you in the next manpage πŸ’‹πŸ¦‹

πŸ“¦ where this page comes from