1

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:

taskset -p 0x01 1
taskset -p 0x01 2
taskset -p 0x01 $$

I still see a lot of threads/processes with PPID 2 running on cores other than 0. This indicates that kthreadd (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?

Edit: Here are, for example, the threads on core 4. Can any of these be moved away from core 4?

~> ps -L -eo pid,ppid,tid,nlwp,tty,comm,psr | grep 4$
  PID  PPID   TID NLWP TT       COMMAND         PSR  <-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
4

1 回答 1

2

一些内核线程绑定到它们的特殊(逻辑)CPU 以执行与该 CPU 相关的一些工作,您无法从它们的 CPU 迁移这些内核线程。您可以做的是迁移和固定所有其他任务。

我猜这个奇怪的要求不是你的最终目的,而且这个(标题)不是达到你目的的正确方法。如果您提供最终目的,SO 中的人员可以帮助您。

于 2012-07-19T07:46:47.457 回答