atomic64_fetch_add_acquire(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– atomic64_fetch_add_acquire β€” Kernel API Manual ✨

Bestie, welcome to the Kernel API Manual entry for atomic64_fetch_add_acquire(9). Yes, the manual name is literally in the title, we're keeping it, it's part of the vibe now. πŸ’… This one is a single function from ./include/linux/atomic and honestly? She's an icon. Let's get into it.


🌸 NAME 🌸

atomic64_fetch_add_acquire β€” atomic add with acquire ordering. That's it, that's the whole name, and it ate. πŸ”₯


πŸ¦‹ SYNOPSIS πŸ¦‹

s64 atomic64_fetch_add_acquire (s64 i , atomic64_t *v );

Look at her. Two arguments, one s64 return. Clean. Minimalist. Main character energy. πŸ‘‘


πŸŽ€ ARGUMENTS πŸŽ€

  • i β€” an s64 value, aka the number you're adding in. This is the "how much" of the whole situation. πŸ“
  • v β€” a pointer to an atomic64_t. This is the thing getting updated, bestie. Point her at it and she goes. ✨

πŸ’œ DESCRIPTION πŸ’œ

Okay so here's the tea: this function atomically updates v to (v + i) with acquire ordering. Atomic means nobody can catch her mid-update β€” no half-done state, no messy in-between, no cap. 🫢 And the acquire ordering is part of the whole package, lowkey doing memory-ordering work for you while she's at it.

⚠️ Heads up, bestie: this is unsafe to use in noinstr code. If you're in noinstr, use raw_atomic64_fetch_add_acquire there instead. Not me warning you and then you doing it anyway β€” don't do it anyway. 😭 Use the raw one. Periodt.

🌈 RETURN 🌈

She returns the original value of v β€” like, the value before the add happened. So you get the before-pic while she posts the after-pic. Iconic behavior, honestly. πŸ“ΈπŸ’–


⭐ SEE ALSO ⭐

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

Bestie, buckle up, because this list is long and every single one of these is invited to the party. πŸŽ‰ They're grouped here so your eyes don't melt, but not one of them got left off the guest list.

The atomic_ girlies (plain, non-64):

The atomic64_ section (our girl's home turf πŸ’…):

The atomic_long_ crew (the long game 🧚):


Anyway, that's the whole page, bestie β€” no sections skipped, no flags dropped, we ate and left no crumbs. πŸ“βœ¨

Sign-off time: this lil beauty lives in the source/version ./include/linux/atomic and the date on the tin is October 2026, so if you're reading this from the future, hiii, hope the kernel is treating you well. πŸ¦‹πŸ’– Bye bestie, go do some atomic adds. πŸ’…

πŸ“¦ where this page comes from