Discussion:
[libvirt-users] Domain vCPU threads affinity
Nikos Anastopoulos
2018-09-05 12:48:45 UTC
Permalink
Hello,

According to the docs, vcpupin will use either cgroups or sched_setaffinity
to pin vcpu threads to cpus. How is this decision made?
I observe differences even on different hosts featuring the same version of
libvirtd (1.3.1): on one host vcpupin affects cpuset.cpus (cgroup), and on
the other it affects vcpu threads affinity (observed through taskset).

Thanks,
Nikos
Ján Tomko
2018-09-05 13:25:09 UTC
Permalink
Post by Nikos Anastopoulos
Hello,
According to the docs, vcpupin will use either cgroups or sched_setaffinity
to pin vcpu threads to cpus. How is this decision made?
I observe differences even on different hosts featuring the same version of
libvirtd (1.3.1): on one host vcpupin affects cpuset.cpus (cgroup), and on
the other it affects vcpu threads affinity (observed through taskset).
It affects both affinity and cpuset.cpus.

Are there any differences in the host environment, or the domain XML?

Also note that libvirt 1.3.1 is 2.5 years old now.

Jano
Nikos Anastopoulos
2018-09-06 06:33:41 UTC
Permalink
Post by Nikos Anastopoulos
Post by Nikos Anastopoulos
Hello,
According to the docs, vcpupin will use either cgroups or
sched_setaffinity
Post by Nikos Anastopoulos
to pin vcpu threads to cpus. How is this decision made?
I observe differences even on different hosts featuring the same version
of
Post by Nikos Anastopoulos
libvirtd (1.3.1): on one host vcpupin affects cpuset.cpus (cgroup), and on
the other it affects vcpu threads affinity (observed through taskset).
It affects both affinity and cpuset.cpus.
Are there any differences in the host environment, or the domain XML?
Also note that libvirt 1.3.1 is 2.5 years old now.
Jano
Hi Jano,

The domain XMLs are the same.

"host1" is an Ubuntu 16.04.4 LTS with a 4.4.0-130-generic kernel. In this
host vcpupin affects cpuset.cpus.
As an observation, note that any change in cpuset.cpus gets reflected in
task affinity, as well. This is a general behavior, not because of Libvirt
and the way that vcpupin works. The opposite is not true, i.e. changing cpu
affinity via sched_setaffinity will leave cpuset.cpus intact -- and will
fail if you try to specify a cpu not belonging to cpuset.cpus.

"host2" is also an Ubuntu 16.04.4 LTS with 4.4.0-87-generic. In that host
vcpupin affects only task affinities.

Nikos

Loading...