3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-25 17:59:25 +01:00

test-runner: set processor count for VM

For better reliability the processor count is now set to qemu.
In cases of low CPU count (< 2) hosts the processor count is
limited to 1. Otherwise half of the host cores will be used for
the VM.
This commit is contained in:
James Prestwood 2020-12-10 09:45:25 -08:00 committed by Denis Kenzior
parent d40cac403f
commit ada46fb2db

View File

@ -1402,6 +1402,19 @@ class Main:
'kernel' 'kernel'
] ]
nproc = multiprocessing.cpu_count()
#
# Specially handle CPU systems with minimal cores, otherwise
# use half the host cores.
#
if nproc < 2:
smp = 1
else:
smp = int(nproc / 2)
print("Using %d cores for VM" % smp)
# #
# This passes through most of the command line options to # This passes through most of the command line options to
# the kernel command line. Some are not relevant (e.g. qemu) # the kernel command line. Some are not relevant (e.g. qemu)
@ -1440,7 +1453,7 @@ class Main:
rootflags=trans=virtio,version=9p2000.u \ rootflags=trans=virtio,version=9p2000.u \
acpi=off pci=noacpi %s ro \ acpi=off pci=noacpi %s ro \
mac80211_hwsim.radios=0 %s' % (kern_log, options), mac80211_hwsim.radios=0 %s' % (kern_log, options),
'-cpu', 'host' '-cpu', 'host', '-smp', str(smp)
] ]
# Add two ethernet devices for testing EAD # Add two ethernet devices for testing EAD