wake_up_var_protected(9)
π wake_up_var_protected(9)
ok so this is a page from the Kernel API Manual bestie, and it's all about wake_up_var_protected β the little function that wakes up your waiter gorlies while asserting that it's safe to do so. yes ma'am, it checks its own vibes before it wakes anybody. π«Ά
β¨ NAME β¨
wake_up_var_protected β wake up waiters for a variable, but like, assert that it is safe first π
β¨ SYNOPSIS β¨
wake_up_var_protected (var , cond );
that's it. two args. slay.
β¨ ARGUMENTS β¨
varβ the address of the variable being waited on. like, the actual address, the location, the spot πcondβ the condition which afirms this is safe. (yes the word in the original is "afirms" β we don't touch it, we respect the ancestors π)
β¨ DESCRIPTION β¨
okay so here's the lore. πΈ
When you're waking waiters that use wait_var_event_any_lock, the waker must be holding the relevant lock, otherwise you get races. like, actual races. not the fun kind. π
This version of wake_up_var asserts that the relevant lock is held β so no barrier is needed, periodt. it already knows. it checked. it's giving main character energy but in a responsible way.
heads up bestie: thecondis only tested whenCONFIG_LOCKDEPis enabled. so if lockdep isn't on, that condition is lowkey just sitting there not being checked. iykyk π«Ά
β¨ SEE ALSO β¨
Kernel file ./include/linux/wait_bit.h β and honestly, the whole wait/wake friend group is here, all iconic, all listed, no cap:
wait_on_bit(9)wait_on_bit_io(9)wait_on_bit_timeout(9)wait_on_bit_action(9)wait_on_bit_lock(9)wait_on_bit_lock_io(9)wait_on_bit_lock_action(9)wait_var_event(9)wait_var_event_io(9)wait_var_event_killable(9)wait_var_event_timeout(9)wait_var_event_interruptible(9)wait_var_event_any_lock(9)wait_var_event_spinlock(9)wait_var_event_mutex(9)wake_up_var_locked(9)clear_and_wake_up_bit(9)test_and_clear_wake_up_bit(9)atomic_dec_and_wake_up(9)store_release_wake_up(9)
okay that's the whole page!! π¦ this one lives in ./include/linux and it's dated October 2026 β so yeah, future girlie behaviour, we love to see it β¨π go wake your variables responsibly, bestie. mwah. π
π¦ 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