Linux 如何隔离CPU核心 isolcpus=0-2
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.conf1 # Examples:2 # isolated_cores=2,4-73 # isolated_cores=2-234 #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/grubGRUB_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相关推荐
- linux 指定cpu运行线程,关于linux:如何查看运行线程的CPU核心?
在Linux中,假设线程的pid是[pid],从目录/ proc / [pid]我们可以获得许多有用的信息. 例如,这些proc文件,/ proc / [pid] / status,/ proc / ...
- Linux设置进程CPU亲和力(核心绑定)
文章目录 1. 获取CPU核数 2. 线程绑定CPU核心 ① 概念 ② 函数 ③ 例子 1. 获取CPU核数 int CPU_NUM = sysconf(_SC_NPROCESSORS_CONF); ...
- Linux查看系统cpu个数、核心书、线程数
Linux查看系统cpu个数.核心书.线程数 现在cpu核心数.线程数越来越高,本文将带你了解如何确定一台服务器有多少个cpu.每个cpu有几个核心.每个核心有几个线程. 查看物理cpu个数 cat ...
- Linux系统C语言获取所有CPU核心的利用率“/proc/stat”
源码地址:https://github.com/Rtoax/test/blob/master/c/cpu/cpu_occupy-proc-stat.c 首先看一下文件"/proc/stat& ...
- linux内核如何支持多核cpu,现在的多核CPU,Linux操作系统是否能够实现单个进程(多线程)的多核调度(跨CPU核心调度)?...
现在的多核CPU,Linux操作系统是否能够实现单个进程(多线程)的多核调度(跨CPU核心调度)? 关注:106 答案:2 mip版 解决时间 2021-02-02 01:11 提问者你說.你愛我 ...
- linux沙箱隔离_360隔离沙箱在WINDOWS 10 的WSL下的沙箱逃逸
简介: 360隔离沙箱是360安全中心于2011年5月14日发布的安全产品,目前内置与360安全卫士的功能大全中.在360隔离沙箱内运行程序完全隔离不怕中毒.快速建立隔离环境,轻量便捷.自动识别与手动 ...
- linux怎么增加cpu负载,Linux下的CPU平均负载
linux下的CPU平均负载 一.注销登陆过的用户 先用w命令查看该用户tty号,然后用fuser -k tty号(或显示pts/*)就可以踢出了 先用w命令查看在线用户 然后 pkill -kill ...
- 如何理解和分析linux系统的CPU平均负载情况(load average)
最近研究linux时接触到了一个新的概念,叫做CPU的平均负载(load average).之前都只听说过CPU的使用情况,很少听说过负载情况.于是对这个概念进行了一下研究学习,总结如下,以便日后查阅 ...
- linux 编译指cpu内核,linux内核编译与配置
linux是如何组成的? 答:linux是由用户空间和内核空间组成的 为什么要划分用户空间和内核空间? 答:有关CPU体系结构,各处理器可以有多种模式,而LInux这样的划分是考虑到系统的 安全性,比 ...
最新文章
- Linux下uniq筛选
- 问题描述 给定一个由n行数字组成的数字三角形如下图所示。试设计一个算法,计算出从三角形的顶至底的一条路径,使该路径经过的数字总和最大。 对于给定的由n行数字组成的数字三角形,计算从三角形的顶至底
- snmp自动化安装脚本
- 数据库 实体间的3种关系
- INSTALL_FAILED_VERSION_DOWNGRADE报错
- 计算机上没有信任的用户,服务器上的安全数据库没有此工作站信任关系的计算机帐户 解决办法...
- 基于Spring Cloud的微服务架构
- 2019年年终总结(流水账)
- 拖延2年的Bug,Linux 上的三星 SSD 驱动错误终于得到修复
- opencv图片变形 仿射 旋转 透视 弯曲 鱼眼特效
- 2019年互联网寒冬,带你走进真实的面试杀出重围
- 如何在photoshop中等比例缩放一张图
- python 超时退出程序_python – 如何在超时后中止multiprocessing.Pool中的任务?
- Qualtrics初体验——10年不融资,价值80亿美金
- 【转】P2P-BT对端管理协议
- 【积水成渊-逐步定制自己的Emacs神器】5:回到最初,重新开始
- 对于信息安全与管理的理解
- 多服务器系统集中管理,服务器集中化管理 日常运维都用什么?
- 大学毕业学技术学什么好
- java nio socketChannel read返回值代表的意思