diff options
author | Przemyslaw Czesnowicz <przemyslaw.czesnowicz@intel.com> | 2015-07-13 17:53:12 +0100 |
---|---|---|
committer | Stephen Finucane <stephen.finucane@intel.com> | 2016-01-14 11:02:51 +0000 |
commit | aaaba4a12eee10ae496e7e372777bfff217db401 (patch) | |
tree | 4b428aea584af406afa854ccce85928d454f34fe /nova/tests/unit/objects/test_numa.py | |
parent | 5d6e0086b578077e7479b78e282e3f7da7ffca71 (diff) | |
download | nova-aaaba4a12eee10ae496e7e372777bfff217db401.tar.gz |
Add 'hw:cpu_threads_policy=isolate' scheduling
The 'isolate' CPU threads policy ensures that hosts provide a non-SMT,
or non-SMT like architecture. In the latter case, if the host provides
an SMT architecture, each vCPU will be placed on a different core and
no vCPUs from other guests will be able to be placed on the same core,
i.e. one thread sibling is guaranteed to always be unused. This
provides a non-SMT like architecture.
The 'isolate' policy, like the 'require' policy, should and will only
be used when explicitly requested by the instance or image.
It is necessary to add changes to the pinning code to ensure that a
core's siblings, if any, will be marked as unusable (rather than just
ignored) when the 'isolate' case is chosen. A core and all its siblings
must be free to be considered usable.
Change-Id: Ibe76846eaf1cee7501cafb9f13a4dd193110ba1f
Implements: bp virt-driver-cpu-thread-pinning
Co-Authored-By: Stephen Finucane <stephen.finucane@intel.com>
DocImpact This completes the CPU thread pinning feature, which should
now be documented as a metadata option.
Diffstat (limited to 'nova/tests/unit/objects/test_numa.py')
-rw-r--r-- | nova/tests/unit/objects/test_numa.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/nova/tests/unit/objects/test_numa.py b/nova/tests/unit/objects/test_numa.py index 98108dd939..64fa8662cf 100644 --- a/nova/tests/unit/objects/test_numa.py +++ b/nova/tests/unit/objects/test_numa.py @@ -100,6 +100,30 @@ class _TestNUMA(object): numacell.unpin_cpus(set([1, 2, 3])) self.assertEqual(set([1, 2, 3, 4]), numacell.free_cpus) + def test_pinning_with_siblings(self): + numacell = objects.NUMACell(id=0, cpuset=set([1, 2, 3, 4]), memory=512, + cpu_usage=2, memory_usage=256, + pinned_cpus=set([]), + siblings=[set([1, 3]), set([2, 4])], + mempages=[]) + + numacell.pin_cpus_with_siblings(set([1, 2])) + self.assertEqual(set(), numacell.free_cpus) + numacell.unpin_cpus_with_siblings(set([1])) + self.assertEqual(set([1, 3]), numacell.free_cpus) + self.assertRaises(exception.CPUPinningInvalid, + numacell.unpin_cpus_with_siblings, + set([3])) + self.assertRaises(exception.CPUPinningInvalid, + numacell.pin_cpus_with_siblings, + set([4])) + self.assertRaises(exception.CPUPinningInvalid, + numacell.unpin_cpus_with_siblings, + set([3, 4])) + self.assertEqual(set([1, 3]), numacell.free_cpus) + numacell.unpin_cpus_with_siblings(set([4])) + self.assertEqual(set([1, 2, 3, 4]), numacell.free_cpus) + def test_pages_topology_wipe(self): pages_topology = objects.NUMAPagesTopology( size_kb=2048, total=1024, used=512) |