避免守护进程在专用的cpu内核中运行 [英] avoid daemon running in dedicated cpu cores

查看:149
本文介绍了避免守护进程在专用的cpu内核中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux 3.10.0-327.el7.x86_64中设置了grub设置isolcpus = 2,我想要的是 避免内核调度程序不将任务调度到cpu核心2,那么我有

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  

查看内核2发生了什么,然后运行我的ap(哪个CPU_SET(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

获取结果:

  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

我知道kworker/2,watchdog/2是管家任务,线程ID 4594是我使用CPU_SET(2)运行我的应用程序的过程,但是我确实想避免sshd,smartd守护程序在核心2中运行,是否有我可以告诉内核避免在内核2中运行守护程序的配置文件或方法?!

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 ?!

在编辑grub之后,应该有update-grub命令,然后重新启动, 我将尝试找出如何更新grub,我认为grub config isolcpus = 2,但尚未启用,在使isolcpus = 2工作后,我将更新结果.

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 .

推荐答案

程序schedtool可能有用,它可以限制进程在指定的cpu上运行. 根据该实用程序的帮助. 要将进程的关联性仅设置为第一个CPU(CPU0),请执行以下操作: #> schedtool -a 0x1 根据您的确切要求替换参数0x1和PID.

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.

这篇关于避免守护进程在专用的cpu内核中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆