Skip to content

Commit b149c30

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Improve documentation of (unpin|pin)_cpus_with_siblings()"
2 parents f27a11f + de10c12 commit b149c30

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

nova/objects/numa.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,34 @@ def unpin_cpus(self, cpus):
106106
self.pinned_cpus -= cpus
107107

108108
def pin_cpus_with_siblings(self, cpus):
109+
"""Pin (consume) both thread siblings if one of them is requested to
110+
be pinned.
111+
112+
:param cpus: set of CPUs to pin
113+
"""
109114
pin_siblings = set()
110115
for sib in self.siblings:
111116
if cpus & sib:
117+
# NOTE(artom) If the intersection between cpus and sib is not
118+
# empty - IOW, the CPU we want to pin has sibligns - pin the
119+
# sibling as well. This is because we normally got here because
120+
# the `isolate` CPU thread policy is set, so we don't want to
121+
# place guest CPUs on host thread siblings.
112122
pin_siblings.update(sib)
113123
self.pin_cpus(pin_siblings)
114124

115125
def unpin_cpus_with_siblings(self, cpus):
126+
"""Unpin (free up) both thread siblings if one of them is requested to
127+
be freed.
128+
129+
:param cpus: set of CPUs to unpin.
130+
"""
116131
pin_siblings = set()
117132
for sib in self.siblings:
118133
if cpus & sib:
134+
# NOTE(artom) This is the inverse operation of
135+
# pin_cpus_with_siblings() - see the NOTE there. If the CPU
136+
# we're unpinning has siblings, unpin the sibling as well.
119137
pin_siblings.update(sib)
120138
self.unpin_cpus(pin_siblings)
121139

0 commit comments

Comments
 (0)