17.6.
# virt-xml testguest1 --edit --cpu host-model
17.6.1. 复制链接链接已复制到粘贴板!
17.6.2. 复制链接链接已复制到粘贴板!
# virsh vcpucount testguest maximum config 4 maximum live 2 current config 2 current live 1
# virsh setvcpus testguest 8 --maximum --config# virsh setvcpus testguest 4 --live# virsh setvcpus testguest 1 --config
# virsh vcpucount testguest maximum config 8 maximum live 4 current config 1 current live 4
17.6.3. 复制链接链接已复制到粘贴板!
[D]
- 注意
- 注意
17.6.4. 复制链接链接已复制到粘贴板!
# virsh nodeinfo CPU model: x86_64 CPU(s): 48 CPU frequency: 1200 MHz CPU socket(s): 1 Core(s) per socket: 12 Thread(s) per core: 2 NUMA cell(s): 2 Memory size: 67012964 KiB# yum install numactl
# virt-xml testguest5 --edit --vcpus placement=auto # virt-xml testguest5 --edit --numatune mode=preferred# echo 1 > /proc/sys/kernel/numa_balancing# systemctl start numad
# numactl --hardware available: 2 nodes (0-1) node 0 size: 18156 MB node 0 free: 9053 MB node 1 size: 18180 MB node 1 free: 6853 MB node distances: node 0 1 0: 10 20 1: 20 10# virsh edit <testguest6> <domain type='kvm'> <name>testguest6</name> ... <vcpu placement='static'>16</vcpu> ... <cpu ...> <numa> <cell id='0' cpus='0-7' memory='16' unit='GiB'/> <cell id='1' cpus='8-15' memory='16' unit='GiB'/> </numa> ... </domain>
17.6.5. 复制链接链接已复制到粘贴板!
# lscpu -p=node,cpu Node,CPU 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7# lscpu -p=node,cpu Node,CPU 0,0 0,1 0,2 0,3# virsh vcpupin testguest6 0 1 # virsh vcpupin testguest6 1 3 # virsh vcpupin testguest6 2 5 # virsh vcpupin testguest6 3 7# virsh vcpupin testguest6 VCPU CPU Affinity ---------------------- 0 1 1 3 2 5 3 7# virsh emulatorpin testguest6 2,4 # virsh emulatorpin testguest6 emulator: CPU Affinity ---------------------------------- *: 2,4
17.6.6. 复制链接链接已复制到粘贴板!
# virsh schedinfo <vm_name> Scheduler : posix cpu_shares : 0 vcpu_period : 0 vcpu_quota : 0 emulator_period: 0 emulator_quota : 0 global_period : 0 global_quota : 0 iothread_period: 0 iothread_quota : 0# virsh schedinfo <vm_name> --set vcpu_period=100000# virsh schedinfo <vm_name> --set vcpu_quota=50000
# virsh schedinfo <vm_name> Scheduler : posix cpu_shares : 2048 vcpu_period : 100000 vcpu_quota : 50000 ...
17.6.7. 复制链接链接已复制到粘贴板!
# virsh schedinfo <vm_name> Scheduler : posix cpu_shares : 1024 vcpu_period : 0 vcpu_quota : 0 emulator_period: 0 emulator_quota : 0 global_period : 0 global_quota : 0 iothread_period: 0 iothread_quota : 0# virsh schedinfo <vm_name> --set cpu_shares=2048 Scheduler : posix cpu_shares : 2048 vcpu_period : 0 vcpu_quota : 0 emulator_period: 0 emulator_quota : 0 global_period : 0 global_quota : 0 iothread_period: 0 iothread_quota : 0
17.6.8. 复制链接链接已复制到粘贴板!
# systemctl stop ksm # systemctl stop ksmtuned# systemctl disable ksm Removed /etc/systemd/system/multi-user.target.wants/ksm.service. # systemctl disable ksmtuned Removed /etc/systemd/system/multi-user.target.wants/ksmtuned.service.注意# echo 2 > /sys/kernel/mm/ksm/run