On Tue, Aug 3, 2010 at 11:15 AM, Ben Pfaff <span dir="ltr">&lt;<a href="mailto:blp@nicira.com">blp@nicira.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+       if (!flow_node) {<br></blockquote><div><br></div><div>While you&#39;re in here, can you put in an unlikely()?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

+       /* Check whether we&#39;ve looped too much. */<br>
+       loop = &amp;get_cpu_var(dp_loop_counters).counters[!!in_interrupt()];<br>
+       if (++loop-&gt;count &gt; DP_MAX_LOOPS)<br>
+               loop-&gt;looping = true;</blockquote><div><br></div><div>This is the extra branch that I was referring to.  We can&#39;t eliminate it completely but now in the non-loop case it will never be taken so it will be no problem for the branch predictor (we could throw in an unlikely() though).</div>
<div><br></div><div>Other than these minor things it looks good.  I tried to think of ways to eliminate additional work but didn&#39;t really see any.  It should be pretty insignificant though.</div></div>