wait_event_lock_irq(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’€ wait_event_lock_irq β€” the kernel API manual, bestie edition πŸ’€

Okay so picture this: you're deep in kernel-land, you've got a spinlock in your hand, and you need to sleep until something happens. That's this function. Welcome to wait_event_lock_irq(9), the manpage for sleeping pretty while holding a lock. Grab a strawberry πŸ“ and let's go.


✨ NAME ✨

wait_event_lock_irq β€” sleep until a condition gets true, and the condition is checked under the lock. It's expected to be called with the lock already taken, no cap. πŸ”’πŸ˜΄


πŸŽ€ SYNOPSIS πŸŽ€

wait_event_lock_irq (wq_head , condition , lock );

🌸 ARGUMENTS 🌸

  • wq_head β€” the waitqueue you're waiting on. Your whole vibe lives here.
  • condition β€” a C expression for the event you're waiting for. This is the thing that has to be true before you get to wake up πŸ’…
  • lock β€” a locked spinlock_t, which gets released before schedule and reacquired afterwards. Yes bestie, it does the unlock/relock dance for you. 🩰

πŸ¦‹ DESCRIPTION πŸ¦‹

So the process gets put to sleep (TASK_UNINTERRUPTIBLE) until the condition evaluates to true. And every single time the waitqueue wq_head gets woken up, the condition gets checked again. Every time. Obsessed with the diligence tbh. ✨

wake_up has to be called after you change any variable that could change the result of the wait condition. Like, that's the rule. Change the thing β†’ call wake_up. Periodt. πŸ”₯

Also this is supposed to be called while you're holding the lock. The lock gets dropped right before going to sleep, and it's reacquired afterwards. It's giving "I'll be right back" energy. 🫢


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/wait.h β€” plus the whole friend group:


🫢 That's the whole page bestie β€” go forth, sleep responsibly, and always reacquire your lock.

This lil doc lives under ./include/linux, dated October 2026, and it's wait_event_lock_irq(9) all the way through. Bye bestie, mwah πŸ’–πŸŒˆβ­

πŸ“¦ where this page comes from