[英]Set the cgroup in centos7 VM and select 4 cpus in this cgroup, make the stress task in this cgroup, but only one of them works
我使用压力工具并在 RT-centos7 VM 中设置了一个 cgroup。 我尝试使用所有选定的 cpus 来减轻 cgroup 中的压力,但只有一个 cpus 起作用,这让我感到困惑。 压力脚本如下:
#!/bin/bash
stress --cpu 3 --io 3 --vm 1
执行代码是:
nohup /home/wxh/scripts/stress_test.sh &
我用过的cgroup命令是: 其他配置都是默认的。
echo 2-5 > cpuset.cpus
echo 0 >cpuset.mems
echo 2216 >> tasks
echo 2217 >> tasks
echo 2218 >> tasks
echo 2219 >> tasks
echo 2220 >> tasks
echo 2221 >> tasks
echo 2222 >> tasks
从 2116 到 2222 的数字是与压力过程相关的 pid。 VM kernel 是:4.19.265-rt117,centos7
htop命令显示只有2号(CPU ID为3)CPU满负荷工作,其他3个cpus根本不工作。
VM配置xml如下:
<domain type='kvm'>
<name>centos7</name>
<memory unit='GiB'>16</memory>
<vcpu>6</vcpu>
<os>
<type arch='aarch64' machine='virt'>hvm</type>
<loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<nvram>/var/lib/libvirt/qemu/nvram/centos7_VARS.fd</nvram>
</os>
<features>
<acpi/>
<gic version='3'/>
</features>
<cpu mode='host-passthrough'>
<topology sockets='2' cores='3' threads='1'/>
</cpu>
<iothreads>1</iothreads>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' iothread="1"/>
<source file='/home/xxx/v1_2th.qcow2'/>
<target dev='vda' bus='virtio'/>
<boot order='1'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/xxx/softwares/Minimal_2th.iso'/>
<readonly/>
<target dev='sdb' bus='scsi'/>
<boot order='2'/>
</disk>
<interface type='network'>
<source network='default'/>
</interface>
<console type='pty'/>
<video>
<model type='virtio'/>
</video>
<controller type='scsi' index='0' model='virtio-scsi'/>
</devices>
<seclabel type='dynamic' model='dac' relabel='yes'/>
<vcpu placement='static' cpuset='64,65,66,67,68,69,70,71'>6</vcpu>
<cputune>
<vcpupin vcpu='0' cpuset='64'/>
<vcpupin vcpu='1' cpuset='65'/>
<vcpupin vcpu='2' cpuset='66'/>
<vcpupin vcpu='3' cpuset='67'/>
<vcpupin vcpu='4' cpuset='68'/>
<vcpupin vcpu='5' cpuset='69'/>
<emulatorpin cpuset='70'/>
<iothreadpin iothread='1' cpuset='71'/>
</cputune>
</domain>
我检查了 cpuset.effective_cpus 和 cpuset.cpu_exclusive,但我认为问题不在这里。 我的目标是让压力过程适用于所有 4 个 cpus。谢谢。
我知道我有什么问题。 问题是您不能同时使用 isolcpus=2-5 命令和 cgroup。 我的决定是撤销 isolcpus 命令。 在此处输入图像描述
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.