raw_atomic_f..._inc_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… raw_atomic_fetch_inc_relaxed πŸ’…

okay so this is a page from the Kernel API Manual, and bestie, it's a short one but it's lowkey iconic. grab a boba, this'll take like two minutes.


✨ NAME ✨

raw_atomic_fetch_inc_relaxed β€” atomic increment with relaxed ordering πŸŽ€


🌸 SYNOPSIS 🌸

int raw_atomic_fetch_inc_relaxed (atomic_t *v );

that's it. that's the whole signature. no cap. 🫢


πŸ¦‹ ARGUMENTS πŸ¦‹

  • v β€” pointer to atomic_t. yeah. that's the whole thing. it's a pointer to an atomic_t, and it is the main character here. πŸ’…

πŸ‘‘ DESCRIPTION πŸ‘‘

so like, here's the vibe: this function atomically updates v to (v + 1) with relaxed ordering. one clean little increment, no drama, no ordering guarantees beyond the relaxed kind. ✨

and the part you actually need to know: it's safe to use in noinstr code. literally built different for that context. BUT β€” and I'm saying this with love β€” prefer atomic_fetch_inc_relaxed everywhere else. raw_ is the special-occasion fit, not the everyday one. iykyk. πŸ™ˆ


πŸ’– RETURN πŸ’–

it hands you back the original value of v β€” like, the value before the increment happened. so you get the pre-glow-up v, and the actual v is already one bigger. fetch-then-bump energy. periodt. ⭐


πŸŽ€ SEE ALSO πŸŽ€

first up, the actual source file, go give it a follow:

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

🧚 the raw_atomic_* besties


πŸ“ the raw_atomic64_* besties


yeah that's a LOT of siblings. it's a whole family reunion up in ./include/linux/atomic. drink water. πŸ’€

and that's the page!! mwah πŸ’‹ this one came from ./include/linux/atomic, dated October 2026, and the header on the tin is raw_atomic_f..._inc_relaxed(9) β€” go forth and increment (relaxedly) bestie πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from