0

New to system performance analyze.

I am curious on how CPU affinity affect kvm virtual machine.

So I try to bind vm's vcpu to physical cpu to improve vm's performance.

  1. find the pid of the vm(ecs-ngrapgcc27eb)
[root@comcvk-001 ~]# virsh list
setlocale: No such file or directory
 Id    Name                       State
-------------------------------------------
 301   ecs-l21kum0j0rjtbxc30e01   running
 336   ecs-hsl-test               running
 342   ecs-mtm22krj09hj           running
 352   ecs-ngrjpo27f59i           running
 353   ecs-ngrapgcc27v7           running
 355   ecs-ngrav032lzgf           running
 356   ecs-ngrapgcc27eb           running
 360   ecs-ngrjpo27f56f           running
  1. find the vm's pid
[root@comcvk-001 ~]# ps -ef | grep ecs-ngrapgcc27eb
root     23352 48449  0 18:09 pts/22   00:00:00 grep --color=auto ecs-ngrapgcc27eb
root     45400     1  2 Jun06 ?        00:38:09 /usr/bin/kvm -name guest=ecs-ngrapgcc27eb,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/var/run/lib/libvirt/qemu/domain-356-ecs-ngrapgcc27eb/master-key.aes -machine pc-i440fx-5.0,accel=kvm,usb=off,dump-guest-core=off,mem-merge=off -cpu Skylake-Server-IBRS,ss=on,hypervisor=on,tsc-adjust=on,clflushopt=on,pku=on,md-clear=on,stibp=on,arch-capabilities=on,ssbd=on,xsaves=on,rsba=on,skip-l1dfl-vmentry=on,hv-crash -m size=4194304k,slots=10,maxmem=263330816k -overcommit mem-lock=off -smp 2,maxcpus=96,sockets=48,dies=1,cores=2,threads=1 -object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu/356-ecs-ngrapgcc27eb,share=yes,size=4294967296 -numa node,nodeid=0,cpus=0-95,memdev=ram-node0 -uuid 751c3250-4b47-4d90-aae9-38f3e9fe3c30 -smbios type=1,serial=ecs-ngrapgcc27eb -no-user-config
  1. find the vcpu thread id(tid)

enter image description here

  1. use taskset -pc to bind thread to physical cpu

I'v set them to core 22,23

enter image description here

I use top to watch the Last Used CPU for a long time, it seems always bind to physical cpu 22 and 23.

enter image description here

I use virsh vcpuinfo to check, it seems ok

enter image description here

But when I use perf to analyze, cpu-migrations still exist, I try to bind these vcpu to many physical cores (tasktset -pc 20-25 45444), it seems not effect to cpu-migrations

enter image description here

enter image description here

I have these questions.

  1. How does these cpu-migrations comes while I see top's Last Used CPU flag not change?

Any help will be appreciate!

0

You must log in to answer this question.

Browse other questions tagged .