vmm: Update NUMA node distances internally

Based on the NumaConfig which now provides distance information, we can
internally update the list of NUMA nodes with the exact distances they
should be located from other nodes.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-08-31 15:05:49 +02:00
parent a5a29134ca
commit 9548e7e857
2 changed files with 33 additions and 2 deletions
+10
View File
@@ -67,6 +67,7 @@ struct HotPlugState {
pub struct NumaNode {
memory_regions: Vec<Arc<GuestRegionMmap>>,
cpus: Vec<u8>,
distances: BTreeMap<u32, u8>,
}
impl NumaNode {
@@ -81,6 +82,14 @@ impl NumaNode {
pub fn cpus_mut(&mut self) -> &mut Vec<u8> {
&mut self.cpus
}
pub fn distances(&self) -> &BTreeMap<u32, u8> {
&self.distances
}
pub fn distances_mut(&mut self) -> &mut BTreeMap<u32, u8> {
&mut self.distances
}
}
pub type NumaNodes = BTreeMap<u32, NumaNode>;
@@ -366,6 +375,7 @@ impl MemoryManager {
NumaNode {
memory_regions: vec![region.clone()],
cpus: Vec::new(),
distances: BTreeMap::new(),
},
);
}