hwspin_lock...ut_in_atomic(9)
π NAME
hwspin_lock_timeout_in_atomic β lock an hwspinlock with timeout limit π
β¨ SYNOPSIS
int hwspin_lock_timeout_in_atomic (struct hwspinlock *hwlock , unsigned
int to );
πΈ ARGUMENTS
hwlockβ the hwspinlock you're trying to lock, bestie. like, the actual lock object π«Άtoβ timeout value in msecs. yes. milliseconds. write it down π
π DESCRIPTION
okay so here's the tea β β this function locks the underlying hwlock. that's it, that's the job.
but if the hwlock is already taken? π the function will busy loop waiting for it to be released β just spinning, spinning, spinning, main character energy β but it gives up when timeout msecs have elapsed. no cap, it will genuinely walk away π
π¨ important-ish warning, lowkey highkey: this function shall be called only from an atomic context, and the timeout value shall not exceed a few msecs. like, a few. don't be out here passing to = 30000 and acting surprised π
return value vibes: returns 0 when the hwlock was successfully taken π and an appropriate error code otherwise β most notably an -ETIMEDOUT if the hwlock is still busy after timeout msecs π
and the iconic part: the function will never sleep. not once. not ever. it's built different π§
π¦ SEE ALSO
kernel file ./include/linux/hwspinlock.h β and the whole friend group, fr fr:
hwspin_trylock_irqsave(9)hwspin_trylock_irq(9)hwspin_trylock_raw(9)hwspin_trylock_in_atomic(9)hwspin_trylock(9)hwspin_lock_timeout_irqsave(9)hwspin_lock_timeout_irq(9)hwspin_lock_timeout_raw(9)hwspin_lock_timeout(9)hwspin_unlock_irqrestore(9)hwspin_unlock_irq(9)hwspin_unlock_raw(9)hwspin_unlock_in_atomic(9)hwspin_unlock(9)
β¨ that's the whole page bestie, you ate that β¨
source vibes: ./include/linux, dated October 2026 β screenshot it, cite it, slay π
ππ
π¦ 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