title: How do poll_wait() and wake_up_interruptible() work in sync?
body: <p>I'm writing a char device similar to uio. <a href="https://elixir.bootlin.com/linux/latest/source/drivers/uio/uio.c" rel="nofollow noreferrer">https://elixir.bootlin.com/linux/latest/source/drivers/uio/uio.c</a> . I see that the process is put to sleep by <code>poll_wait()</code> in poll file operation and woken up when an interrupt occurs <code>wake_up_interruptible()</code>. I couldn't understand how wait and wake_up calls are synced.</p>
  <p>Consider this case.</p>
  <p><code>poll()</code> syscall is done in the userspace.</p>
  <p><code>uio_poll()</code> is executed.</p>
  <p>Just before <code>poll_wait()</code>, an interrupt occurs and <code>wake_up_interruptible()</code> is done.</p>
  <p>Now <code>poll_wait()</code> is executed.</p>
  <p>Isn't it possible that <code>poll()</code> call  would get blocked forever in case there are no further interrupts?</p>