簡體   English   中英

在centos7 VM中設置cgroup,在這個cgroup中設置select 4 cpus,在這個cgroup中做壓力任務,但只有一個有效

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM