File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -106,16 +106,34 @@ def unpin_cpus(self, cpus):
106
106
self .pinned_cpus -= cpus
107
107
108
108
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
+ """
109
114
pin_siblings = set ()
110
115
for sib in self .siblings :
111
116
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.
112
122
pin_siblings .update (sib )
113
123
self .pin_cpus (pin_siblings )
114
124
115
125
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
+ """
116
131
pin_siblings = set ()
117
132
for sib in self .siblings :
118
133
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.
119
137
pin_siblings .update (sib )
120
138
self .unpin_cpus (pin_siblings )
121
139
You can’t perform that action at this time.
0 commit comments