<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Hi Linux hackers !</div><div><br data-mce-bogus="1"></div><div>I'm reading some code in net/core/dev.c and something puzzles me : somewhere in __dev_queue_xmit, we have :<br>        int cpu = smp_processor_id(); /* ok because BHs are off */<br><br>and, indeed, a few lines up there is :<br>    /* Disable soft irqs for various locks below. Also<br>     * stops preemption for RCU.<br>     */<br>    rcu_read_lock_bh();<br><br>Now I'm wondering : is this really ok ?<br>From what I understand, this code can very well run in user context, with hard IRQs ON, and in fact it should, according to the following comment :<br><br> *      When calling this method, interrupts MUST be enabled.  This is because<br> *      the BH enable code must have IRQs enabled so that it will not deadlock.<br> *          --BLG<br><br>Then I guess it could be preempted at any time, especially with aggressive versions of preemptions ?<br>And if so, are we not at risk that our thread is migrated to an other CPU just after smp_processor_id returned ?<br><br>Cheers,<br></div><div><br data-mce-bogus="1"></div><div>V Ray<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div></div><div id="content_out_vray_kalrayinc.com"></div></body></html>