futex_lock_pi_atomic(9)
π futex_lock_pi_atomic(9)
okay so bestie, we're diving into the Kernel API Manual today and the star of the show is futex_lock_pi_atomic β the atomic work required to acquire a pi aware futex. yes it's as serious as it sounds and yes you're gonna slay it π«Ά
β¨ NAME β¨
futex_lock_pi_atomic β Atomic work required to acquire a pi aware futex
πΈ SYNOPSIS πΈ
int futex_lock_pi_atomic (u32 __user *uaddr , struct futex_hash_bucket
*hb , union futex_key *key , struct futex_pi_state **ps , struct
task_struct *task , struct task_struct **exiting , int set_waiters );
π ARGUMENTS π
uaddrβ the pi futex user address πhbβ the pi futex hash bucketkeyβ the futex key associated withuaddrandhbpsβ the pi_state pointer where we store the result of the lookuptaskβ the task to perform the atomic lock work for. this will be"current"except in the case of requeue pi. iykyk πexitingβ Pointer to store the task pointer of the owner task which is in the middle of exitingset_waitersβ force setting theFUTEX_WAITERSbit (1) or not (0)
π₯ RETURN π₯
0β ready to wait;1β acquired the lock;<0β error
π¦ DESCRIPTION π¦
The hb->lock must be held by the caller. no cap, that's on you, not on the function π
exiting is only set when the return value is -EBUSY. If so, this holds a refcount on the exiting task on return and the caller needs to drop it after waiting for the exit to complete.
fr fr bestie, don't forget to drop that refcount after the exit finishes β the vibes will NOT be immaculate otherwise π
π SEE ALSO π
- Kernel file
./kernel/futex/pi.c fixup_pi_owner(9)
okay that's the whole page, you ate that πβ¨ this iconic lil doc came from ./kernel/futex, dated October 2026, and it's the futex_lock_pi_atomic(9) Kernel API Manual entry β go forth and lock those pi aware futexes, main character ππ¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms