raw_atomic_dec(9)
β¨ raw_atomic_dec(9) β¨
okay so bestie, welcome to the Kernel API Manual π this one's a tiny little icon, a real "small but mighty" situation, so let's get into it π«Ά
πΈ NAME πΈ
raw_atomic_dec β the atomic decrement, but make it relaxed ordering π§β¨
π SYNOPSIS π
void raw_atomic_dec (atomic_t *v );
that's it. that's the whole vibe. one pointer, no return, no drama π
π¦ ARGUMENTS π¦
vβ pointer to anatomic_t. yes queen, it's an atomic_t pointer, not avoid *, not anint *, don't even try it π
π₯ DESCRIPTION π₯
so what it does is atomically update v to (v - 1) β with relaxed ordering. that's the whole assignment, no cap. it's giving "subtract one, but make it thread-safe" π
and the reason this little guy exists: it's safe to use in noinstr code. noinstr is the super-strict zone where you literally cannot be doing certain things, and raw_atomic_dec is allowed in there π
but listen β preferatomic_decelsewhere π like,raw_atomic_decis the special-occasion one. for the normal everyday case, useatomic_dec. iykyk π«Ά
β RETURN β
Nothing. zero. nada. it returns void, it's a void girlie, it does the thing and leaves π β¨
π SEE ALSO π
okay this is the part where the page goes absolutely feral with cross-references, and honestly? iconic behavior π every single one of these is here, let's go π
π the raw_atomic_t reading & writing core π
raw_atomic_read(9), raw_atomic_read_acquire(9), raw_atomic_set(9), raw_atomic_set_release(9)
π raw_atomic_t add family π
raw_atomic_add(9), raw_atomic_add_return(9), raw_atomic_add_return_acquire(9), raw_atomic_add_return_release(9), raw_atomic_add_return_relaxed(9), raw_atomic_fetch_add(9), raw_atomic_fetch_add_acquire(9), raw_atomic_fetch_add_release(9), raw_atomic_fetch_add_relaxed(9)
π raw_atomic_t subtract family π
raw_atomic_sub(9), raw_atomic_sub_return(9), raw_atomic_sub_return_acquire(9), raw_atomic_sub_return_release(9), raw_atomic_sub_return_relaxed(9), raw_atomic_fetch_sub(9), raw_atomic_fetch_sub_acquire(9), raw_atomic_fetch_sub_release(9), raw_atomic_fetch_sub_relaxed(9)
π raw_atomic_t increment family π
raw_atomic_inc(9), raw_atomic_inc_return(9), raw_atomic_inc_return_acquire(9), raw_atomic_inc_return_release(9), raw_atomic_inc_return_relaxed(9), raw_atomic_fetch_inc(9), raw_atomic_fetch_inc_acquire(9), raw_atomic_fetch_inc_release(9), raw_atomic_fetch_inc_relaxed(9)
π raw_atomic_t decrement family (hi, this page's cousins) π
raw_atomic_dec_return(9), raw_atomic_dec_return_acquire(9), raw_atomic_dec_return_release(9), raw_atomic_dec_return_relaxed(9), raw_atomic_fetch_dec(9), raw_atomic_fetch_dec_acquire(9), raw_atomic_fetch_dec_release(9), raw_atomic_fetch_dec_relaxed(9)
π raw_atomic_t bitwise: and / andnot π
raw_atomic_and(9), raw_atomic_fetch_and(9), raw_atomic_fetch_and_acquire(9), raw_atomic_fetch_and_release(9), raw_atomic_fetch_and_relaxed(9), raw_atomic_andnot(9), raw_atomic_fetch_andnot(9), raw_atomic_fetch_andnot_acquire(9), raw_atomic_fetch_andnot_release(9), raw_atomic_fetch_andnot_relaxed(9)
π raw_atomic_t bitwise: or / xor π
raw_atomic_or(9), raw_atomic_fetch_or(9), raw_atomic_fetch_or_acquire(9), raw_atomic_fetch_or_release(9), raw_atomic_fetch_or_relaxed(9), raw_atomic_xor(9), raw_atomic_fetch_xor(9), raw_atomic_fetch_xor_acquire(9), raw_atomic_fetch_xor_release(9), raw_atomic_fetch_xor_relaxed(9)
π raw_atomic_t exchange π
raw_atomic_xchg(9), raw_atomic_xchg_acquire(9), raw_atomic_xchg_release(9), raw_atomic_xchg_relaxed(9)
π raw_atomic_t compare-and-exchange π
raw_atomic_cmpxchg(9), raw_atomic_cmpxchg_acquire(9), raw_atomic_cmpxchg_release(9), raw_atomic_cmpxchg_relaxed(9), raw_atomic_try_cmpxchg(9), raw_atomic_try_cmpxchg_acquire(9), raw_atomic_try_cmpxchg_release(9), raw_atomic_try_cmpxchg_relaxed(9)
π raw_atomic_t test / negative / unless variants π
raw_atomic_sub_and_test(9), raw_atomic_dec_and_test(9), raw_atomic_inc_and_test(9), raw_atomic_add_negative(9), raw_atomic_add_negative_acquire(9), raw_atomic_add_negative_release(9), raw_atomic_add_negative_relaxed(9), raw_atomic_fetch_add_unless(9), raw_atomic_add_unless(9), raw_atomic_inc_not_zero(9), raw_atomic_inc_unless_negative(9), raw_atomic_dec_unless_positive(9), raw_atomic_dec_if_positive(9)
π now the whole 64-bit era, because she's thorough π
π raw_atomic64_t reading & writing core π
raw_atomic64_read(9), raw_atomic64_read_acquire(9), raw_atomic64_set(9), raw_atomic64_set_release(9)
π raw_atomic64_t add family π
raw_atomic64_add(9), raw_atomic64_add_return(9), raw_atomic64_add_return_acquire(9), raw_atomic64_add_return_release(9), raw_atomic64_add_return_relaxed(9), raw_atomic64_fetch_add(9), raw_atomic64_fetch_add_acquire(9), raw_atomic64_fetch_add_release(9), raw_atomic64_fetch_add_relaxed(9)
π raw_atomic64_t subtract family π
raw_atomic64_sub(9), raw_atomic64_sub_return(9), raw_atomic64_sub_return_acquire(9), raw_atomic64_sub_return_release(9), raw_atomic64_sub_return_relaxed(9), raw_atomic64_fetch_sub(9), raw_atomic64_fetch_sub_acquire(9), raw_atomic64_fetch_sub_release(9), raw_atomic64_fetch_sub_relaxed(9)
π raw_atomic64_t increment family π
raw_atomic64_inc(9), raw_atomic64_inc_return(9), raw_atomic64_inc_return_acquire(9), raw_atomic64_inc_return_release(9), raw_atomic64_inc_return_relaxed(9), raw_atomic64_fetch_inc(9), raw_atomic64_fetch_inc_acquire(9), raw_atomic64_fetch_inc_release(9), raw_atomic64_fetch_inc_relaxed(9)
π raw_atomic64_t decrement family π
raw_atomic64_dec(9), raw_atomic64_dec_return(9), raw_atomic64_dec_return_acquire(9), raw_atomic64_dec_return_release(9), raw_atomic64_dec_return_relaxed(9), raw_atomic64_fetch_dec(9), raw_atomic64_fetch_dec_acquire(9), raw_atomic64_fetch_dec_release(9), raw_atomic64_fetch_dec_relaxed(9)
π raw_atomic64_t bitwise: and / andnot π
raw_atomic64_and(9), raw_atomic64_fetch_and(9), raw_atomic64_fetch_and_acquire(9), raw_atomic64_fetch_and_release(9), raw_atomic64_fetch_and_relaxed(9), raw_atomic64_andnot(9), raw_atomic64_fetch_andnot(9), raw_atomic64_fetch_andnot_acquire(9), raw_atomic64_fetch_andnot_release(9), raw_atomic64_fetch_andnot_relaxed(9)
π raw_atomic64_t bitwise: or / xor π
raw_atomic64_or(9), raw_atomic64_fetch_or(9), raw_atomic64_fetch_or_acquire(9), raw_atomic64_fetch_or_release(9), raw_atomic64_fetch_or_relaxed(9), raw_atomic64_xor(9), raw_atomic64_fetch_xor(9), raw_atomic64_fetch_xor_acquire(9), raw_atomic64_fetch_xor_release(9), raw_atomic64_fetch_xor_relaxed(9)
π raw_atomic64_t exchange π
raw_atomic64_xchg(9), raw_atomic64_xchg_acquire(9), raw_atomic64_xchg_release(9), raw_atomic64_xchg_relaxed(9)
π raw_atomic64_t compare-and-exchange π
raw_atomic64_cmpxchg(9), raw_atomic64_cmpxchg_acquire(9), raw_atomic64_cmpxchg_release(9), raw_atomic64_cmpxchg_relaxed(9), raw_atomic64_try_cmpxchg(9), raw_atomic64_try_cmpxchg_acquire(9), raw_atomic64_try_cmpxchg_release(9), raw_atomic64_try_cmpxchg_relaxed(9)
π raw_atomic64_t test / negative / unless variants π
raw_atomic64_sub_and_test(9), raw_atomic64_dec_and_test(9), raw_atomic64_inc_and_test(9), raw_atomic64_add_negative(9), raw_atomic64_add_negative_acquire(9), raw_atomic64_add_negative_release(9), raw_atomic64_add_negative_relaxed(9), raw_atomic64_fetch_add_unless(9), raw_atomic64_add_unless(9), raw_atomic64_inc_not_zero(9), raw_atomic64_inc_unless_negative(9), raw_atomic64_dec_unless_positive(9), raw_atomic64_dec_if_positive(9)
π§ and the actual source file, bestie π§
- Kernel file
./include/linux/atomic/atomic-arch-fallback.hβ that's where she lives π
fr fr that's the whole page. tiny function, massive cross-reference section, main character energy π
πΈπ
β¨ and that's a wrap! this lil page is brought to you by the ./include/linux/atomic crew, dated October 2026, living under the raw_atomic_dec(9) name in the Kernel API Manual β mwah, go decrement something atomically, ily π«Άππ
π¦ 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