wait_var_event_killable(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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

okay bestie, buckle up, we're learning about wait_var_event_killable(9) today and honestly? she's kind of a queen πŸ‘‘

🌸 NAME 🌸

wait_var_event_killable β€” literally just wait for a variable to be updated and notified, that's the whole vibe 🫢


✨ SYNOPSIS ✨

wait_var_event_killable (var , condition );

no cap, that's the entire call signature. two args, one dream πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • var β€” the address of the variable being waited on πŸ“ like, the actual location of the thing you're sitting around waiting on. main character address energy.
  • condition β€” the condition to wait for πŸ¦‹ the thing that has to become true before you can go home.

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so here's the tea β˜• β€” this function waits for a condition to be true or for a fatal signal to be received. but here's the iconic detail: it only re-checks the condition when a wake up is received for var. that's it, that's the whole loop. no busy-waiting, no spam-checking, we're patient and elegant πŸ’…

and var is an arbitrary kernel address which need not be directly related to the given condition, but usually is. so like yeah, you can be messy about it, but usually you're normal about it πŸ™ˆ

this is similar to wait_var_event but returns a value which is 0 if the condition became true, or -ERESTARTSYS if a fatal signal was received. slay, a return value. we love a function that tells us what happened πŸ’–

🧚 and bestie, listen β€” the condition should normally use smp_load_acquire or a similarly ordered access to ensure that any changes to memory made before the condition became true will be visible after the wait completes. this part is NOT optional-vibes, this is the memory-ordering part. do not skip it. for real fr fr 😭

🌈 SEE ALSO 🌈

so the kernel file is ./include/linux/wait_bit.h and here's the whole friend group 🫢 β€” go say hi:


and that's the page! πŸŽ€ source lives in ./include/linux, dated October 2026, and it's wait_var_event_killable(9) forever and always πŸ’œ go forth and wait on your variables, bestie ✨

πŸ“¦ where this page comes from