wait_event_lock_irq_cmd(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– wait_event_lock_irq_cmd(9) πŸ’–

okay bestie, welcome to the Kernel API Manual β€” this one is giving "sleepy kernel function with main character energy" and honestly? iconic. ✨


✨ NAME ✨

wait_event_lock_irq_cmd β€” sleep until a condition gets true. The condition is checked under the lock, and this is expected to be called with the lock taken. πŸ’…


🌸 SYNOPSIS 🌸

wait_event_lock_irq_cmd (wq_head , condition , lock , cmd );

πŸŽ€ ARGUMENTS πŸŽ€

  • wq_head β€” the waitqueue to wait on. literally the queue where your sleepy little process is gonna chill. 😴
  • condition β€” a C expression for the event to wait for. this is the thing that has to become true before you wake up, no cap. ✨
  • lock β€” a locked spinlock_t, which will be released before cmd and schedule and reacquired afterwards. yes bestie, it locks, it unlocks, it locks again β€” the full glow-up cycle. πŸ”„
  • cmd β€” a command which is invoked outside the critical section before sleep. tiny side quest before naptime. 🫢

πŸ¦‹ DESCRIPTION πŸ¦‹

The process is put to sleep (TASK_UNINTERRUPTIBLE) until the condition evaluates to true. The condition is checked each time the waitqueue wq_head is woken up. so like, every wake-up is a vibe check for your condition. πŸ‘‘

wake_up has to be called after changing any variable that could change the result of the wait condition. don't forget this part, fr fr β€” otherwise your process is just gonna be asleep forever and that's not the slay you think it is. 😭

This is supposed to be called while holding the lock. The lock is dropped before invoking the cmd and going to sleep, and is reacquired afterwards. so the order is: hold the lock β†’ drop it β†’ run cmd β†’ sleep β†’ wake up β†’ grab the lock again. periodt. πŸ’…


🌈 SEE ALSO 🌈

Kernel file ./include/linux/wait.h β€” and the whole waitqueue friend group, because they all ate:


and that's the whole page, bestie β€” sourced from ./include/linux, dated October 2026, and yes the function is still wait_event_lock_irq_cmd(9) because we don't do name changes around here. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from