vmm: Update NUMA nodes based on NumaConfig

Relying on the list of CPUs defined through the NumaConfig, this patch
will update the internal list of CPUs attached to each NUMA node.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-08-28 19:18:33 +02:00
parent 42f963d6f2
commit db28db8567
2 changed files with 39 additions and 2 deletions
+14
View File
@@ -66,12 +66,21 @@ struct HotPlugState {
#[derive(Clone)]
pub struct NumaNode {
memory_regions: Vec<Arc<GuestRegionMmap>>,
cpus: Vec<u8>,
}
impl NumaNode {
pub fn memory_regions(&self) -> &Vec<Arc<GuestRegionMmap>> {
&self.memory_regions
}
pub fn cpus(&self) -> &Vec<u8> {
&self.cpus
}
pub fn cpus_mut(&mut self) -> &mut Vec<u8> {
&mut self.cpus
}
}
pub type NumaNodes = BTreeMap<u32, NumaNode>;
@@ -356,6 +365,7 @@ impl MemoryManager {
node_id,
NumaNode {
memory_regions: vec![region.clone()],
cpus: Vec::new(),
},
);
}
@@ -1233,6 +1243,10 @@ impl MemoryManager {
pub fn numa_nodes(&self) -> &NumaNodes {
&self.numa_nodes
}
pub fn numa_nodes_mut(&mut self) -> &mut NumaNodes {
&mut self.numa_nodes
}
}
#[cfg(feature = "acpi")]