<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Affinity on bramp.net</title>
    <link>https://blog.bramp.net/</link>
    <description>Recent content in Affinity on bramp.net</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-GB</language>
    <lastBuildDate>Mon, 16 Mar 2009 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bramp.net/tags/affinity/" rel="self" type="application/rss+xml" />
    
    <item>
      <title>IRQ Affinity on FreeBSD</title>
      <link>https://blog.bramp.net/post/2009/03/16/irq-affinity-on-freebsd/</link>
      <pubDate>Mon, 16 Mar 2009 00:00:00 +0000</pubDate>
      
      <guid>https://blog.bramp.net/post/2009/03/16/irq-affinity-on-freebsd/</guid>
      <description><p>On Linux it is quite simple to set the CPU affinity of a IRQ, by for example issuing the following command:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">cat <span class="m">1</span> &gt; /proc/irq/#/smp_affinity
</span></span></code></pre></div><p>This will ensure that IRQ # will always fire on core 1. It is also possible to specify affinities such as 3, which pins the IRQ to just core 1 and 2.</p>
<p>This can be very helpful to stop your IRQ interrupts bouncing between all the cores. For example, if you have a single threaded app which is generating all the network traffic then it makes sense to ensure the network card’s interrupt will fire on the same core, or at least a core which is close (in terms of cache sharing).</p>
<p>Recently I was looking for a way to pin IRQ on FreeBSD, however, it appears FreeBSD 7.1 still doesn’t support this feature, but FreeBSD-CURRENT does! I don’t advise people try FreeBSD-CURRENT yet, but when it turns into FreeBSD 8.0, then you can issue a command such as:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">cpuset -l <span class="m">0</span> -x irq#
</span></span></code></pre></div><p>which will pin the IRQ to core 0, or</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">cpuset -l 0,1 -x irq#
</span></span></code></pre></div><p>which will pin the IRQ to cores 0 and 1.</p>
<p>Hopefully this feature will be back ported to FreeBSD 7.X. I’m a unsure how likely this will be considering there is a chunk of code missing from the 7.X kernel, which I assume will only be in FreeBSD 8.0.</p>
</description>
    </item>
    
  </channel>
</rss>
