Merge "Allow linear packing of cores" into stable/newton
This commit is contained in:
commit
d1c3d8717b
|
@ -2397,6 +2397,19 @@ class CPUPinningCellTestCase(test.NoDBTestCase, _CPUPinningTestCaseBase):
|
|||
got_topo = objects.VirtCPUTopology(sockets=1, cores=3, threads=1)
|
||||
self.assertEqualTopology(got_topo, inst_pin.cpu_topology)
|
||||
|
||||
def test_get_pinning_host_siblings_instance_mixed_siblings(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3, 4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0,
|
||||
siblings=[set([0, 1]), set([2, 3]),
|
||||
set([4, 5]), set([6, 7])],
|
||||
mempages=[], pinned_cpus=set([0, 1, 2, 5]))
|
||||
inst_pin = objects.InstanceNUMACell(cpuset=set([0, 1, 2, 3]),
|
||||
memory=2048)
|
||||
inst_pin = hw._numa_fit_instance_cell_with_pinning(host_pin, inst_pin)
|
||||
self.assertInstanceCellPinned(inst_pin)
|
||||
got_topo = objects.VirtCPUTopology(sockets=1, cores=4, threads=1)
|
||||
self.assertEqualTopology(got_topo, inst_pin.cpu_topology)
|
||||
|
||||
def test_get_pinning_host_siblings_instance_odd_fit_orphan_only(self):
|
||||
host_pin = objects.NUMACell(id=0, cpuset=set([0, 1, 2, 3, 4, 5, 6, 7]),
|
||||
memory=4096, memory_usage=0,
|
||||
|
|
|
@ -752,7 +752,7 @@ def _pack_instance_onto_cores(available_siblings,
|
|||
len(instance_cell))
|
||||
elif (instance_cell.cpu_thread_policy ==
|
||||
fields.CPUThreadAllocationPolicy.PREFER):
|
||||
LOG.debug("Request 'prefer' thread policy for %d cores",
|
||||
LOG.debug("Requested 'prefer' thread policy for %d cores",
|
||||
len(instance_cell))
|
||||
elif (instance_cell.cpu_thread_policy ==
|
||||
fields.CPUThreadAllocationPolicy.ISOLATE):
|
||||
|
@ -774,7 +774,7 @@ def _pack_instance_onto_cores(available_siblings,
|
|||
pinning = _get_pinning(1, # we only want to "use" one thread per core
|
||||
sibling_sets[threads_per_core],
|
||||
instance_cell.cpuset)
|
||||
else:
|
||||
else: # REQUIRE, PREFER (explicit, implicit)
|
||||
# NOTE(ndipanov): We iterate over the sibling sets in descending order
|
||||
# of cores that can be packed. This is an attempt to evenly distribute
|
||||
# instances among physical cores
|
||||
|
@ -795,6 +795,15 @@ def _pack_instance_onto_cores(available_siblings,
|
|||
if pinning:
|
||||
break
|
||||
|
||||
# NOTE(sfinucan): If siblings weren't available and we're using PREFER
|
||||
# (implicitly or explicitly), fall back to linear assignment across
|
||||
# cores
|
||||
if (instance_cell.cpu_thread_policy !=
|
||||
fields.CPUThreadAllocationPolicy.REQUIRE and
|
||||
not pinning):
|
||||
pinning = zip(sorted(instance_cell.cpuset),
|
||||
itertools.chain(*sibling_set))
|
||||
|
||||
threads_no = _threads(instance_cell, threads_no)
|
||||
|
||||
if not pinning:
|
||||
|
|
Loading…
Reference in New Issue