ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Linux 如何隔离CPU核心 isolcpus=0-2

2021-05-08 17:00:15  阅读:1136  来源: 互联网

标签:profile Optimize realtime isolcpus virtual tuned host Linux CPU


Linux 如何隔离CPU核心 isolcpus=0-2


rtoax
2021年5月8日

1. tuned调优方式隔核

1.1. 首先查看当前调优方式

# tuned-adm active 
Current active profile: realtime-virtual-host

1.2. tuned查看可用的调优方式

# tuned-adm profile 
Available profiles:
- balanced                    - General non-specialized tuned profile
- desktop                     - Optimize for the desktop use-case
- latency-performance         - Optimize for deterministic performance at the cost of increased po
wer consumption- network-latency             - Optimize for deterministic performance at the cost of increased po
wer consumption, focused on low latency network performance- network-throughput          - Optimize for streaming network throughput, generally only necessar
y on older CPUs or 40G+ networks- powersave                   - Optimize for low power consumption
- realtime                    - Optimize for realtime workloads
- realtime-virtual-guest      - Optimize for realtime workloads running within a KVM guest
- realtime-virtual-host       - Optimize for KVM guests running realtime workloads
- throughput-performance      - Broadly applicable tuning that provides excellent performance acro
ss a variety of common server workloads- virtual-guest               - Optimize for running inside a virtual guest
- virtual-host                - Optimize for running KVM guests
Current active profile: realtime-virtual-host

1.3. 查看系统存在调优方式的配置文件

# ls /etc/tuned/
active_profile  profile_mode             realtime-virtual-guest-variables.conf  recommend.d
bootcmdline     realtime-variables.conf  realtime-virtual-host-variables.conf   tuned-main.conf

1.4. 修改tuned 某一种调优方式的配置文件profile

# vim realtime-virtual-host-variables.conf

  1 # Examples:
  2 # isolated_cores=2,4-7
  3 # isolated_cores=2-23
  4 #
  5 isolated_cores=0

通过修改isolated_cores的数字来隔离CPU

1.5. tuned 生效一种调优方式

tuned-adm profile realtime-virtual-host

1.6. 重启生效配置

reboot

2. 修改grub配置文件

隔核调优方式也可以直接在/etc/default/grub中修改。

vim /etc/default/grub

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap no_timer_check clocksource=tsc tsc=perfect intel_pstate=disable selinux=0 enforcing=0 nmi_watchdog=0 softlockup_panic=0 isolcpus=1-39 nohz_full=0-39 idle=poll default_hugepagesz=1G hugepagesz=1G hugepages=16 rcu_nocbs=1-39 kthread_cpus=0 irqaffinity=0 rcu_nocb_poll rhgb quiet"

修改grub配置文件后需要更新grub配置文件,运行一下命令

grub2-mkconfig -o /boot/grub2/grub.cfg

然后重启生效

reboot

3. 查看隔核情况

$ more /proc/cmdline 
BOOT_IMAGE=/vmlinuz-3.10.0-1062.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root r
d.lvm.lv=centos/swap rhgb quiet skew_tick=1 isolcpus=2-3 intel_pstate=disable nosoftlockup

其中isolcpus=2-3即为隔离的CPU。

标签:profile,Optimize,realtime,isolcpus,virtual,tuned,host,Linux,CPU
来源: https://blog.csdn.net/Rong_Toa/article/details/116533692

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有