title: Calling schedule() inside Linux IRQ
body: <p>I'm making an emulation driver that requires me to call <code>schedule()</code> in ATOMIC contexts in order to make the emulation part work. For now I have this hack that allows me to call <code>schedule()</code> inside ATOMIC (e.g. spinlock) context:</p>
  
  <pre><code>int p_count = current_thread_info()-&gt;preempt_count;
  
  current_thread_info()-&gt;preempt_count = 0;
  schedule();
  current_thread_info()-&gt;preempt_count = p_count;
  </code></pre>
  
  <p>But that doesn't work inside IRQs, the system just stops afer calling <code>schedule()</code>.</p>
  
  <p>Is there any way to hack the kernel in a way to allow me to do it? I'm using Linux kernel 4.2.1 with User Mode Linux</p>