raw_atomic_..._sub_release(9)
π raw_atomic_..._sub_release(9) π
okay so bestie, welcome to the Kernel API Manual β yes we're literally in the kernel docs rn, and this page is called raw_atomic_..._sub_release(9) and honestly? it's giving niche but essential. buckle up π
β¨ NAME β¨
raw_atomic_long_fetch_sub_release β atomic subtract, but make it release ordering π«
β¨ SYNOPSIS β¨
long raw_atomic_long_fetch_sub_release (long i , atomic_long_t *v );
β¨ ARGUMENTS β¨
iβ alongvalue, and it's the amount you're subtracting. the subtraction victim, if you will π«Άvβ a pointer to anatomic_long_t. this is the actual atomic bestie getting updated π
β¨ DESCRIPTION β¨
so what it does, no cap: it atomically updates v to (v - i), and it does it with release ordering. atomically means nobody sneaks in halfway, okay? the whole subtract-slash-update is one indivisible moment. iconic behavior honestly π
it's safe to use in noinstr code β like, that's literally its whole niche. everywhere else though? prefer atomic_long_fetch_sub_release, bestie. that's the general-purpose one. this raw version is the specialist π§
β¨ RETURN β¨
it hands you back the original value of v β i.e. what v was before your subtraction happened. so you get the before-pic, and v keeps the after-pic πΈ
β¨ SEE ALSO β¨
first up, the source of truth, the origin story:
- Kernel file
./include/linux/atomic/atomic-long.h
and now the whole friend group π literally everyone:
π¦ the reads
π¦ the sets
π¦ the adds
raw_atomic_long_add(9)raw_atomic_long_add_return(9)raw_atomic_long_add_return_acquire(9)raw_atomic_long_add_return_release(9)raw_atomic_long_add_return_relaxed(9)raw_atomic_long_fetch_add(9)raw_atomic_long_fetch_add_acquire(9)raw_atomic_long_fetch_add_release(9)raw_atomic_long_fetch_add_relaxed(9)
π¦ the subs (our literal family)
raw_atomic_long_sub(9)raw_atomic_long_sub_return(9)raw_atomic_long_sub_return_acquire(9)raw_atomic_long_sub_return_release(9)raw_atomic_long_sub_return_relaxed(9)raw_atomic_long_fetch_sub(9)raw_atomic_long_fetch_sub_acquire(9)raw_atomic_long_fetch_sub_relaxed(9)
π¦ the incs
raw_atomic_long_inc(9)raw_atomic_long_inc_return(9)raw_atomic_long_inc_return_acquire(9)raw_atomic_long_inc_return_release(9)raw_atomic_long_inc_return_relaxed(9)raw_atomic_long_fetch_inc(9)raw_atomic_long_fetch_inc_acquire(9)raw_atomic_long_fetch_inc_release(9)raw_atomic_long_fetch_inc_relaxed(9)
π¦ the decs
raw_atomic_long_dec(9)raw_atomic_long_dec_return(9)raw_atomic_long_dec_return_acquire(9)raw_atomic_long_dec_return_release(9)raw_atomic_long_dec_return_relaxed(9)raw_atomic_long_fetch_dec(9)raw_atomic_long_fetch_dec_acquire(9)raw_atomic_long_fetch_dec_release(9)raw_atomic_long_fetch_dec_relaxed(9)
π¦ the bitwise girlies
raw_atomic_long_and(9)raw_atomic_long_fetch_and(9)raw_atomic_long_fetch_and_acquire(9)raw_atomic_long_fetch_and_release(9)raw_atomic_long_fetch_and_relaxed(9)raw_atomic_long_andnot(9)raw_atomic_long_fetch_andnot(9)raw_atomic_long_fetch_andnot_acquire(9)raw_atomic_long_fetch_andnot_release(9)raw_atomic_long_fetch_andnot_relaxed(9)raw_atomic_long_or(9)raw_atomic_long_fetch_or(9)raw_atomic_long_fetch_or_acquire(9)raw_atomic_long_fetch_or_release(9)raw_atomic_long_fetch_or_relaxed(9)raw_atomic_long_xor(9)raw_atomic_long_fetch_xor(9)raw_atomic_long_fetch_xor_acquire(9)raw_atomic_long_fetch_xor_release(9)raw_atomic_long_fetch_xor_relaxed(9)
π¦ the exchanges
raw_atomic_long_xchg(9)raw_atomic_long_xchg_acquire(9)raw_atomic_long_xchg_release(9)raw_atomic_long_xchg_relaxed(9)
π¦ the compare-and-swap squad
raw_atomic_long_cmpxchg(9)raw_atomic_long_cmpxchg_acquire(9)raw_atomic_long_cmpxchg_release(9)raw_atomic_long_cmpxchg_relaxed(9)raw_atomic_long_try_cmpxchg(9)raw_atomic_long_try_cmpxchg_acquire(9)raw_atomic_long_try_cmpxchg_release(9)raw_atomic_long_try_cmpxchg_relaxed(9)
π¦ the tests
raw_atomic_long_sub_and_test(9)raw_atomic_long_dec_and_test(9)raw_atomic_long_inc_and_test(9)raw_atomic_long_add_negative(9)raw_atomic_long_add_negative_acquire(9)raw_atomic_long_add_negative_release(9)raw_atomic_long_add_negative_relaxed(9)
π¦ the conditional cuties
raw_atomic_long_fetch_add_unless(9)raw_atomic_long_add_unless(9)raw_atomic_long_inc_not_zero(9)raw_atomic_long_inc_unless_negative(9)raw_atomic_long_dec_unless_positive(9)raw_atomic_long_dec_if_positive(9)
fr fr go read those if you wanna understand the whole atomic-long cinematic universe. this page is one star in a very big, very shiny constellation β
and that's the whole page babes π it lives in ./include/linux/atomic, it's from October 2026, and it's part of the Kernel API Manual. go forth and subtract atomically, you absolute main character πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms