raw_atomic_f..._dec_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_f..._dec_acquire β€” Kernel API Manual ✨

okay so bestie, we're in the kernel API manual today and this page is about raw_atomic_f..._dec_acquire. yes the title is lowkey doing the absolute most with those ellipses but she's iconic like that πŸŽ€


🌸 NAME 🌸

raw_atomic_fetch_dec_acquire β€” atomic decrement with acquire ordering. that's it. that's the whole vibe. decrement, atomically, with acquire ordering, periodt πŸ’…


✨ SYNOPSIS ✨

int raw_atomic_fetch_dec_acquire (atomic_t *v );

🫢 ARGUMENTS 🫢

  • v β€” pointer to atomic_t. literally just a pointer to the atomic thing you're about to subtract from. that's her whole job πŸ¦‹

πŸ”₯ DESCRIPTION πŸ”₯

So the way this works: it atomically updates v to (v - 1) with acquire ordering. atomically means nobody can catch her mid-decrement, and acquire ordering means the memory ordering is chef's kiss properly constrained. no cap πŸ’€

She is safe to use in noinstr code β€” that's her whole moment, that's why she's a raw_ girlie 🌈 but everywhere else, prefer atomic_fetch_dec_acquire. yes she's telling you to use her cousin. it's giving humble. we respect it πŸ™ˆ


πŸ‘‘ RETURN πŸ‘‘

The original value of v. not the new one, not the decremented one β€” the original one, bestie. read the room (and the return value) πŸ’–


⭐ SEE ALSO ⭐

Kernel file ./include/linux/atomic/atomic-arch-fallback.h β€” that's where she lives 🏠

and now, the family reunion. everybody showed up. every. single. one. πŸŽ€

like I said. everybody. she has a big family and she loves them all πŸ’œ


fr fr though: raw_ is for the noinstr girlies. if you're not in noinstr code, use atomic_fetch_dec_acquire and let the normal layer handle it. iykyk 😭

and that's the page bestie!! this little gem comes from ./include/linux/atomic, dated October 2026 β€” signed, sealed, slayed πŸ’…πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from