atomic_inc_return_relaxed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ atomic_inc_return_relaxed ✨

okay so bestie, this one lives in the Kernel API Manual and it's genuinely such a vibe β€” an atomic increment that gives you the new value back, with relaxed ordering. let's get into it πŸ’…


πŸŽ€ NAME πŸŽ€

atomic_inc_return_relaxed β€” atomic increment, but make it relaxed ordering ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

int atomic_inc_return_relaxed (atomic_t *v );

🌸 ARGUMENTS 🌸

  • v β€” pointer to atomic_t. yes that's it. one (1) whole argument, we love a low-maintenance icon 🫢

πŸ’– DESCRIPTION πŸ’–

So basically it atomically updates v to (v + 1) with relaxed ordering. atomic meaning nobody can catch it mid-update, relaxed meaning it's not out here enforcing any extra ordering rules. chill but correct, yk? 😌

⚠️ okay important one, no cap: this is unsafe to use in noinstr code. if you're in noinstr land, use raw_atomic_inc_return_relaxed there instead. literally do not mix these up πŸ’€

πŸ‘‘ RETURN πŸ‘‘

The updated value of v. so you get the new number back, not the old one β€” main character behavior honestly πŸ”₯


🌈 SEE ALSO 🌈

the full friend group, in the kernel file ./include/linux/atomic/atomic-instrumented.h β€” and bestie there are so many of them, but we're listing every single one because we don't do half-finished 🫢

the atomic_* girlies:

the atomic64_* besties:

the atomic_long_* crew:


and that's the whole page, bestie πŸ’œ

this little icon comes to you straight out of the kernel file ./include/linux/atomic, dated October 2026 β€” like, an actual time traveler πŸ¦‹ anyway ily, go increment something atomically (relaxedly) πŸŽ€βœ¨

πŸ“¦ where this page comes from