title: Ensuring all Linux system threads run on core 0
body: <p>I want to ensure that all system threads in Linux run on core 0, leaving all the other cores to my application. I am using RHEL 6 and I have added the following lines at the top of /etc/rc.d/rc.sysinit:</p>
  
  <pre><code>taskset -p 0x01 1
  taskset -p 0x01 2
  taskset -p 0x01 $$
  </code></pre>
  
  <p>I still see a lot of threads/processes with PPID 2 running on cores other than 0. This indicates that <code>kthreadd</code> (the process with PID 2) spawns others before the above statements are executed. How can I ensure that all children of process 2 also run of core 0?</p>
  
  <p>Edit: Here are, for example, the threads on core 4. Can any of these be moved away from core 4?</p>
  
  <pre><code>~&gt; ps -L -eo pid,ppid,tid,nlwp,tty,comm,psr | grep 4$
    PID  PPID   TID NLWP TT       COMMAND         PSR  &lt;-line added
     15     2    15    1 ?        migration/4       4
     16     2    16    1 ?        ksoftirqd/4       4
     17     2    17    1 ?        watchdog/4        4
     31     2    31    1 ?        events/4          4
     46     2    46    1 ?        kintegrityd/4     4
     54     2    54    1 ?        kblockd/4         4
     65     2    65    1 ?        ata/4             4
     88     2    88    1 ?        aio/4             4
     96     2    96    1 ?        crypto/4          4
    420     2   420    1 ?        ext4-dio-unwrit   4
    879     2   879    1 ?        kdmflush          4
    926     2   926    1 ?        ext4-dio-unwrit   4
    935     2   935    1 ?        ext4-dio-unwrit   4
   1632     2  1632    1 ?        rpciod/4          4
  </code></pre>