Linux 如何隔离CPU核心 isolcpus=0-2
2021/5/9 7:29:47
本文主要是介绍Linux 如何隔离CPU核心 isolcpus=0-2,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
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。
这篇关于Linux 如何隔离CPU核心 isolcpus=0-2的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23linux 系统宝塔查看网站访问的命令是什么?-icode9专业技术文章分享
- 2024-11-12如何创建可引导的 ESXi USB 安装介质 (macOS, Linux, Windows)
- 2024-11-08linux的 vi编辑器中搜索关键字有哪些常用的命令和技巧?-icode9专业技术文章分享
- 2024-11-08在 Linux 的 vi 或 vim 编辑器中什么命令可以直接跳到文件的结尾?-icode9专业技术文章分享
- 2024-10-22原生鸿蒙操作系统HarmonyOS NEXT(HarmonyOS 5)正式发布
- 2024-10-18操作系统入门教程:新手必看的基本操作指南
- 2024-10-18初学者必看:操作系统入门全攻略
- 2024-10-17操作系统入门教程:轻松掌握操作系统基础知识
- 2024-09-11Linux部署Scrapy学习:入门级指南
- 2024-09-11Linux部署Scrapy:入门级指南