Reputation: 850
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
Upvotes: 1
Views: 2830
Reputation: 1420
Some kernel threads were bound to their special (logic)CPU to do some work related that CPU, You can't migrate those kernel threads from their CPU. What you can do is migrating and pinning all the other tasks.
I guess this strange requirement is not your final purpose, and this(the title) is not the right approach to your purpose. If you provide your final purpose, guys in the SO can help you.
Upvotes: 2