barfatchen
barfatchen

Reputation: 1698

avoid daemon running in dedicated cpu cores

I have grub set isolcpus=2 in my linux 3.10.0-327.el7.x86_64 , what I want is avoid the kernel scheduler not to schedule task to cpu core 2 , then I have the

perf  record -e  sched:sched_switch -C 2  

to see what is going on in core 2 and then run my ap(which CPU_SET(2) , and following command :

perf report --show-total-period -i perf.data

get result :

  48.85%            85  swapper         [kernel.kallsyms]  [k] __schedule
  18.97%            33  kworker/u384:0  [kernel.kallsyms]  [k] __schedule
  11.49%            20  :4594           [kernel.kallsyms]  [k] __schedule
  11.49%            20  smartd          [kernel.kallsyms]  [k] __schedule
   4.60%             8  watchdog/2      [kernel.kallsyms]  [k] __schedule
   3.45%             6  sshd            [kernel.kallsyms]  [k] __schedule
   1.15%             2  kworker/2:2     [kernel.kallsyms]  [k] __schedule

I know kworker/2 , watchdog/2 are housekeeping tasks , thread id 4594 is what I run my app with CPU_SET(2) , But I really do want to avoid sshd , smartd daemons running in core 2 , Is there any config file or methods I can do to tell kernel that avoid daemons running in core 2 ?!

Edit :

after edit grub , there should be update-grub command and then reboot , I will try to figure out how to update-grub , I think grub config isolcpus=2 but it is not enabled yet , I will update the result after I make isolcpus=2 work .

Upvotes: 2

Views: 890

Answers (1)

wen
wen

Reputation: 114

The program 'schedtool' maybe helpful, it can limit the process to run on specified cpu(s). according to the help of that utility. To set a process' affinity to only the first CPU (CPU0): #> schedtool -a 0x1 replace the parameters 0x1 and PID according your exactly requirement.

Upvotes: 1

Related Questions