#223 inventory-qcow2: Use physical cores, match libvirt CPU invocation
Merged by astepano. Opened by walters.
walters/standard-test-roles cpu-cores  into  master

Download 223.patch

I was investigating some rpm-ostree CI performance issues in
https://github.com/projectatomic/rpm-ostree/pull/1362
and I discovered that my previous change to use -smp $cpus was
suboptimal. See the linked libvirt discussion; basically we
really want to use physical cores, otherwise the guest kernel
is going to make bad scheduling decisions.

We also take care to also minimize that set by the number of
CPUs available to us; we may be running in a container with
a cgroup for example.

https://jenkins-fedora-atomic-process.apps.ci.centos.org/job/str_pr_test/141/console

W0611: 11,0: : Unused import multiprocessing
Running: pycodestyle --max-line-length=120 /home/jenkins/workspace/str_pr_test/inventory/standard-inventory-qcow2
/home/jenkins/workspace/str_pr_test/inventory/standard-inventory-qcow2:116:1: E302 expected 2 blank lines, found 1
/home/jenkins/workspace/str_pr_test/inventory/standard-inventory-qcow2:132:1: E302 expected 2 blank lines, found 1

rebased onto cfea24086363d2f7b76fb393ae1232640e5226c7

OK, updated :arrow_up:

lscpu is part of util-linux RPM. OK
nproc is part of coreutils. OK

About next code:

This PR has: '{},sockets={},cores=1,threads=1'.format(sockets, sockets)

From qemu documentation:

-smp [cpus=]n[,cores=cores][,threads=threads][,sockets=sockets][,maxcpus=maxcpus]
... For the PC target, the number of cores per socket, the number of threads per cores and the total number of sockets can be specified. Missing values will be computed.

Then from the email: https://www.redhat.com/archives/libvirt-users/2017-June/msg00025.html

By defaulting to giving the guest **only sockets**, you get fixed predictable
behaviour from the guest OS, as the host OS moves vCPUs threads around.

I am not sure why we need to set cores=1,threads=1.

Are there performance benefits from cores=1,threads=1 ?

I am not sure why we need to set cores=1,threads=1.

It's probably implicit, but the idea here is just to match what libvirt is doing, makes things easier to compare.

@walters thank you!

Commit e442d09e fixes this pull-request

Pull-Request has been merged by astepano

Pull-Request has been merged by astepano

Metadata