raw_atomic_f..._sub_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

okay so this is raw_atomic_f..._sub_relaxed(9), a page from the Kernel API Manual ✨. The actual name is raw_atomic_fetch_sub_relaxed, and it’s giving atomic subtract with relaxed ordering πŸ’….


✨ SYNOPSIS ✨

int raw_atomic_fetch_sub_relaxed (int i , atomic_t *v );

πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” an int value to subtract. yes bestie, it’s the number getting taken away πŸ“.
  • v β€” pointer to atomic_t. this is the atomic variable getting updated, main character energy πŸ‘‘.

πŸ’– DESCRIPTION πŸ’–

Atomically updates v to (v - i) with relaxed ordering ✨. Like, the whole update happens atomically; the ordering is the relaxed kind β€” it’s literally in the name, iykyk.

It’s safe to use in noinstr code, which is iconic of it 🫢. Everywhere else, though? Prefer atomic_fetch_sub_relaxed β€” the raw one is the special-case bestie.

caveat bestie: safe in noinstr code; outside that, prefer atomic_fetch_sub_relaxed elsewhere πŸ’….

πŸ¦‹ RETURN πŸ¦‹

The original value of v β€” aka what v was before the subtract happened. You get the pre-subtract number back, no cap 😭.

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file: ./include/linux/atomic/atomic-arch-fallback.h 🧚

And the whole raw atomic squad, because the SEE ALSO section said β€œbring everyone” 🌈:

mwah πŸ’‹ β€” source/version ./include/linux/atomic, dated October 2026, for the raw_atomic_f..._sub_relaxed(9) page. bye bestie 🫢

πŸ“¦ where this page comes from