From 0a0c174fbc13eb7a972ab394c0a999a1fe1312d8 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 20 Mar 2020 13:31:06 +0000 Subject: [PATCH] hardware: Don't consider overhead CPUs for unpinned instances The 'cpuset_reserved' argument for the '_numa_fit_instance_cell' function is only ever non-zero if the 'isolate' CPU thread policy is in effect, and this thread policy can only be used if using the 'dedicated' CPU policy is used. As such, we don't need to worry about overhead if either the 'share' CPU thread policy or the 'shared' CPU policy is in effect. Part of blueprint use-pcpu-and-vcpu-in-one-instance Change-Id: Ib863b6a8d3bd3d2848fabd777fc1ac3387a7dd42 Signed-off-by: Stephen Finucane --- nova/virt/hardware.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nova/virt/hardware.py b/nova/virt/hardware.py index 4ca867e0308f..9657a108cc78 100644 --- a/nova/virt/hardware.py +++ b/nova/virt/hardware.py @@ -1127,8 +1127,6 @@ def _numa_fit_instance_cell(host_cell, instance_cell, limit_cell=None, # NOTE(stephenfin): As with memory, do not allow an instance to overcommit # against itself on any NUMA cell if instance_cell.cpu_policy == fields.CPUAllocationPolicy.DEDICATED: - # TODO(stephenfin): Is 'cpuset_reserved' present if consuming emulator - # threads from shared CPU pools? If so, we don't want to add this here required_cpus = len(instance_cell.cpuset) + cpuset_reserved if required_cpus > len(host_cell.pcpuset): LOG.debug('Not enough host cell CPUs to fit instance cell; ' @@ -1140,14 +1138,12 @@ def _numa_fit_instance_cell(host_cell, instance_cell, limit_cell=None, }) return else: - required_cpus = len(instance_cell.cpuset) + cpuset_reserved + required_cpus = len(instance_cell.cpuset) if required_cpus > len(host_cell.cpuset): LOG.debug('Not enough host cell CPUs to fit instance cell; ' - 'required: %(required)d + %(cpuset_reserved)d as ' - 'overhead, actual: %(actual)d', { + 'required: %(required)d, actual: %(actual)d', { 'required': len(instance_cell.cpuset), 'actual': len(host_cell.cpuset), - 'cpuset_reserved': cpuset_reserved }) return