raw_atomic_...turn_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_sub_return_acquire β€” Kernel API Manual ✨

okay so bestie, you found it: raw_atomic_...turn_acquire(9) β€” that's the raw_atomic_sub_return_acquire page from the Kernel API Manual, and it's genuinely one of my faves. it's tiny, it's atomic, it has acquire ordering, and it's giving "small but mighty" energy. let's get into it 🫢


✨ NAME ✨

raw_atomic_sub_return_acquire β€” atomic subtract with acquire ordering πŸ’–

like, it subtracts. atomically. and it returns. and the ordering is acquire. the name literally ate, no notes.


πŸ¦‹ SYNOPSIS πŸ¦‹

int raw_atomic_sub_return_acquire (int i , atomic_t *v );

that's it. two args, one int coming back at you. iconic. 🌸


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” an int value, and it's the value you're subtracting. the thing being taken away. the minus. πŸ‘‹
  • v β€” a pointer to atomic_t. this is your main character β€” the atomic variable getting updated. πŸ‘‘

πŸ’œ DESCRIPTION πŸ’œ

so here's the whole vibe: it atomically updates v to (v - i), and it does it with acquire ordering. no cap. πŸ”₯

and the important part for the kernel girlies: this one is safe to use in noinstr code β€” that's literally its whole reason to exist. but if you're not in noinstr code? please, bestie, use atomic_sub_return_acquire instead. it said what it said. πŸ’…

ngl, this is the "I'm built different for a very specific reason" of atomic functions. respect the niche. 🧚

⭐ RETURN ⭐

it returns the updated value of v. so like, the new number. after the subtraction. already done. you get the result, not a "did it work" β€” the value itself. slay. ✨


🌈 SEE ALSO 🌈

okay this list is long and honestly kind of breathtaking. it's the whole raw atomic family tree and we're gonna name every single one. buckle up, bestie 🎒

the file it lives in:

  • Kernel file ./include/linux/atomic/atomic-arch-fallback.h β€” yeah, that's the house. 🏠

raw atomic classics β€” reading and writing:

the add era:

the sub era β€” and yes, notice sub_return_acquire is missing bc that's literally this page, you're looking at it, hi πŸ‘‹πŸ’–:

the inc arc:

the dec saga:

bitwise besties, and + andnot:

bitwise besties, or + xor:

swap + compare-exchange energy:

the testers + the "unless" crew:


🌟 and now… the 64-bit remix 🌟

same energy, bigger numbers. every single one, coming right up πŸ‘‘

read/set:

add:

sub:

inc:

dec:

and / andnot:

or / xor:

xchg / cmpxchg / try_cmpxchg:

the 64-bit testers + unless crew (final boss energy):

that's all of them. every single one. you're welcome. my fingers are fine, thanks for asking πŸ˜­πŸ’…

and that's the page, bestie! this cutie lives in ./include/linux/atomic, and it was dated October 2026 β€” so it's a little time traveler, a little legend, and honestly? it understood the assignment. πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from