CPU Pinning / CPU Affinity

  • Thread starter Thread starter Deleted member 186410
  • Start date Start date
D

Deleted member 186410

Guest
Hey guys,

I just have one question I jsut don't understand.

Example:

I have a 4 cores cpu, that in htop is shown as cores from "0-7".
I have 4 VM's, the first two cpu affinity was set to 0, on the third to 0,1.
On the fourth where the heavy load is to 2,3.

So does it now also automatically use the cores and threads? Or do I need to include the threads also or just the cores?
Cause I did it like that, but the threads have very low load, but maybe its normal.

I hope you can understand my question, thank you.
 
Proxmox will see 8 CPUs. Whether the hyperthreads are 1,3,5,7 or 4,5,6,7 depends on your actual CPU and you can find out with cat /proc/cpuinfo.
Why not limit the heavy VM to two (or four) without affinity and allow the Linux scheduler to just do its thing? What problem are you trying to solve with affinity?
 
Hey, thanks for the reply.

Maybe I got this whole stuff wrong, I thought with CPU Affinity I can pin the cores to the VM's that I want.
True, I also could just pin specific cores to the heavy VM like 2,3 or 4,5,6,7.
Using your provided commands, I see under "cpu cores= 4", but it displays my CPU model 8 times.
What does that mean?
 
Maybe I got this whole stuff wrong, I thought with CPU Affinity I can pin the cores to the VM's that I want.
Yes, but maybe there are better solution for your actual problem, if there is a problem. You actually pin virtual cores to physical threads (0-7).
Using your provided commands, I see under "cpu cores= 4", but it displays my CPU model 8 times.
What does that mean?
Proxmox/Linux sees 8 CPUs ("things that can execute programs"), which correspond to the 8 threads of your CPU. It can do 8 things at the same time, that's why you see 8 times (almost) the same information. Look at the core id of each and you'll see which two threads are from the same physical core (0-7). The processor number (0-8) is what you use for affinity.
 
Last edited:
  • Like
Reactions: Thorvi and levtol

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!