atomic_long..._inc_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– atomic_long_fetch_inc_relaxed πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” yes, that Kernel API Manual β€” and today we're hyperfixating on one (1) extremely specific atomic helper. she's small, she's relaxed, and she literally just adds one. no cap. πŸ¦‹


🌸 NAME 🌸

atomic_long_fetch_inc_relaxed β€” atomic increment with relaxed ordering ✨

like, she bumps your number up by one, atomically, and hands you back what it used to be. main character energy tbh πŸ‘‘


✨ SYNOPSIS ✨

long atomic_long_fetch_inc_relaxed (atomic_long_t *v );

that's it. that's the whole vibe. one function, one pointer, no drama πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • v β€” pointer to atomic_long_t. yes queen, that's the thing you're incrementing 🫢

πŸ”₯ DESCRIPTION πŸ”₯

Atomically updates v to (v + 1) with relaxed ordering.

so the way that works is: it reads v, it adds one, it writes it back β€” all as one atomic little unit so nobody else can sneak in mid-operation and ruin her moment. and the ordering is relaxed, meaning she's not doing any extra memory-barrier choreography around it. lowkey efficient, highkey iconic ✨

⚠️ Unsafe to use in noinstr code β€” use raw_atomic_long_fetch_inc_relaxed there. like fr fr, do NOT bring this one to the noinstr party, she is not invited πŸ’€

⭐ RETURN ⭐

The original value of v. 🎁

not the new one!! the original one. she increments first, then hands you the receipt for what it was before. iykyk πŸ™ˆ


🌈 SEE ALSO 🌈

literally the entire atomic cinematic universe, bestie. grab a snack. πŸ“

Kernel file ./include/linux/atomic/atomic-instrumented.h

πŸ’œ the atomic_ girlies

πŸ¦‹ the atomic64_ queens

πŸ‘‘ the atomic_long_ icons (our girl's whole family)


okay that's the whole page, and yes i did read all of it so you don't have to. πŸ’…

sign-off time: this little love letter lives in ./include/linux/atomic, it's dated October 2026, and its manual title is atomic_long..._inc_relaxed(9) in case you need to cite her in an essay. go forth and increment, bestie β€” atomically, and relaxed. πŸ§šπŸ’œ

πŸ“¦ where this page comes from