Skip to content

Commit 799d8f2

Browse files
klihubaskervin
authored andcommitted
sysfs: patch up asymmetric NUMA distances.
Hide asymmetric NUMA distances by replacing asymmetric distance pairs by their average. Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 27e83df commit 799d8f2

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pkg/sysfs/system.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,6 +1460,26 @@ func (sys *system) discoverNodes() error {
14601460
}
14611461
}
14621462

1463+
// Patch any asymmetric NUMA matrix using the average distance.
1464+
// Notes:
1465+
// Instead of hiding asymmetricity completely, we might want to keep
1466+
// the pristine distances and instead update System.NodeDistance to
1467+
// return an average for asymmetric distance pairs.
1468+
for id1, n1 := range sys.nodes {
1469+
for id2, n2 := range sys.nodes {
1470+
if id1 == id2 {
1471+
continue
1472+
}
1473+
if n1.distance[id2] != n2.distance[id1] {
1474+
avg := (n1.distance[id2] + n2.distance[id1]) / 2
1475+
log.Warnf("asymmetric NUMA distance [%d, %d]: %d != %d, patching up with %d",
1476+
id1, id2, n1.distance[id2], n2.distance[id1], avg)
1477+
n1.distance[id2] = avg
1478+
n2.distance[id1] = avg
1479+
}
1480+
}
1481+
}
1482+
14631483
return nil
14641484
}
14651485

0 commit comments

Comments
 (0)