wake_up_var(9)
okay so bestie, welcome to the Kernel API Manual β this is wake_up_var(9) and itβs giving synchronization realness β¨π
π NAME π
wake_up_var β wake up waiters on a variable (kernel address), periodt π«Ά
β¨ SYNOPSIS β¨
void wake_up_var (void *var );
π ARGUMENTS π
varβ the address of the variable being waited on, no cap π¦
πΈ DESCRIPTION πΈ
So basically: wake_up_var wakes up any process thatβs waiting in wait_var_event or similar for the given variable to change π₯ wait_var_event can be waiting for an arbitrary condition to be true, and it associates that condition with an address. Calling wake_up_var suggests that the condition has been made true, but it does not strictly require the condtion to use the address given (yes, condtion, exactly like that β keeping the pageβs spelling, iykyk ππ).
The wake-up is sent to tasks in a waitqueue selected by hash from a shared pool. Only those tasks on that queue which have requested wake_up on this specific address will be woken π
For this to function properly, there must be a full memory barrier after the variable is updated β or, more accurately, after the condition waited on has been made to be true β and before this function is called β If the variable was updated atomically, like the page says βsuch as a by atomic_decβ, then smb_mb__after_atomic can be used. If the variable was updated by a fully ordered operation such as atomic_dec_and_test, then no extra barrier is required. Otherwise smb_mb is needed π
Normally the variable should be updated (the condition should be made to be true) by an operation with RELEASE semantics such as smp_store_release, so that any changes to memory made before the variable was updated are guaranteed to be visible after the matching wait_var_event completes π
π¦ SEE ALSO π¦
- Kernel file
./kernel/sched/wait_bit.candwake_up_bit(9)π§
mwah π β this page lives under ./kernel/sched, dated October 2026, and itβs wake_up_var(9); periodt πβ¨
π¦ 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