raw_atomic64..._sub_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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

okay so bestie, welcome to raw_atomic64_fetch_sub_relaxed(9), straight out of the Kernel API Manual. it's a little subtract-y gremlin with relaxed ordering and honestly? it's giving quiet luxury. no drama, no fences, just vibes and math. πŸ¦‹


🌸 NAME 🌸

raw_atomic64_fetch_sub_relaxed β€” atomic subtract with relaxed ordering. that's it. that's the whole thing. periodt. πŸ’–


✨ SYNOPSIS ✨

s64 raw_atomic64_fetch_sub_relaxed (s64 i , atomic64_t *v );

like... look at her. two arguments. one return type. flawless. πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” the s64 value you're subtracting. the amount you're taking away. the "not me putting this back" energy. πŸ™ˆ
  • v β€” a pointer to the atomic64_t. this is where the whole thing actually happens. main character address. 🫢

🌈 DESCRIPTION 🌈

so here's the tea: this bad girl atomically updates v to (v - i) with relaxed ordering. atomic means nobody can catch her mid-subtract β€” the whole thing lands as one single, indivisible move. no cap. πŸ”₯

and because it's relaxed, you're not asking the compiler or the CPU for any extra ordering guarantees beyond what's written. it's chill like that. ✨

lowkey the important bit: it's safe to use in noinstr code β€” that's the whole reason this raw_ version exists. but everywhere else? the manpage literally says to prefer atomic64_fetch_sub_relaxed instead. so like, use the normal one unless you have to be in noinstr land. iykyk. πŸ’€

⚠️ bestie please read that again: use this one in noinstr code, and prefer atomic64_fetch_sub_relaxed elsewhere. that's not me being extra, that's the actual doc. πŸŽ€

⭐ RETURN ⭐

it hands you back the original value of v β€” like, the value before the subtraction happened. the "before" pic. the glow-up hasn't occurred yet in this snapshot. πŸ“Έ

so you get the old number, and v quietly holds the new one. iconic behavior, honestly. πŸ‘‘


πŸ’œ SEE ALSO πŸ’œ

the kernel file this lives in, in all its glory:

  • ./include/linux/atomic/atomic-arch-fallback.h

and now... the family. the whole entire family. every single one of them, no skips, no cap. this is the group chat and everyone showed up: 🌸


and that's the whole page bestie, you ate it up. πŸ“ this lil beauty comes from ./include/linux/atomic, dated October 2026, and it's filed under raw_atomic64..._sub_relaxed(9) β€” go forth and subtract atomically, mwah πŸ’‹πŸ’–

πŸ“¦ where this page comes from