mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
vmm: Add 'guest_numa_node' option to 'memory-zone'
With the introduction of this new option, the user will be able to describe if a particular memory zone should belong to a specific NUMA node from a guest perspective. For instance, using '--memory-zone size=1G,guest_numa_node=2' would let the user describe that a memory zone of 1G in the guest should be exposed as being associated with the NUMA node 2. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
274c001eab
commit
768dbd1fb0
@ -120,7 +120,8 @@ fn create_app<'a, 'b>(
|
|||||||
.help(
|
.help(
|
||||||
"User defined memory zone parameters \
|
"User defined memory zone parameters \
|
||||||
\"size=<guest_memory_region_size>,file=<backing_file>,\
|
\"size=<guest_memory_region_size>,file=<backing_file>,\
|
||||||
shared=on|off,hugepages=on|off,host_numa_node=<node_id>\"",
|
shared=on|off,hugepages=on|off,host_numa_node=<node_id>,\
|
||||||
|
guest_numa_node=<node_id>\"",
|
||||||
)
|
)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.min_values(1)
|
.min_values(1)
|
||||||
|
@ -470,6 +470,9 @@ components:
|
|||||||
host_numa_node:
|
host_numa_node:
|
||||||
type: integer
|
type: integer
|
||||||
format: uint32
|
format: uint32
|
||||||
|
guest_numa_node:
|
||||||
|
type: integer
|
||||||
|
format: uint32
|
||||||
|
|
||||||
MemoryConfig:
|
MemoryConfig:
|
||||||
required:
|
required:
|
||||||
|
@ -354,6 +354,8 @@ pub struct MemoryZoneConfig {
|
|||||||
pub hugepages: bool,
|
pub hugepages: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub host_numa_node: Option<u32>,
|
pub host_numa_node: Option<u32>,
|
||||||
|
#[serde(default)]
|
||||||
|
pub guest_numa_node: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||||
@ -434,7 +436,8 @@ impl MemoryConfig {
|
|||||||
.add("file")
|
.add("file")
|
||||||
.add("shared")
|
.add("shared")
|
||||||
.add("hugepages")
|
.add("hugepages")
|
||||||
.add("host_numa_node");
|
.add("host_numa_node")
|
||||||
|
.add("guest_numa_node");
|
||||||
parser.parse(memory_zone).map_err(Error::ParseMemoryZone)?;
|
parser.parse(memory_zone).map_err(Error::ParseMemoryZone)?;
|
||||||
|
|
||||||
let size = parser
|
let size = parser
|
||||||
@ -456,6 +459,9 @@ impl MemoryConfig {
|
|||||||
let host_numa_node = parser
|
let host_numa_node = parser
|
||||||
.convert::<u32>("host_numa_node")
|
.convert::<u32>("host_numa_node")
|
||||||
.map_err(Error::ParseMemoryZone)?;
|
.map_err(Error::ParseMemoryZone)?;
|
||||||
|
let guest_numa_node = parser
|
||||||
|
.convert::<u32>("guest_numa_node")
|
||||||
|
.map_err(Error::ParseMemoryZone)?;
|
||||||
|
|
||||||
zones.push(MemoryZoneConfig {
|
zones.push(MemoryZoneConfig {
|
||||||
size,
|
size,
|
||||||
@ -463,6 +469,7 @@ impl MemoryConfig {
|
|||||||
shared,
|
shared,
|
||||||
hugepages,
|
hugepages,
|
||||||
host_numa_node,
|
host_numa_node,
|
||||||
|
guest_numa_node,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some(zones)
|
Some(zones)
|
||||||
|
@ -379,6 +379,7 @@ impl MemoryManager {
|
|||||||
shared: config.shared,
|
shared: config.shared,
|
||||||
hugepages: config.hugepages,
|
hugepages: config.hugepages,
|
||||||
host_numa_node: None,
|
host_numa_node: None,
|
||||||
|
guest_numa_node: None,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
(config.size, zones)
|
(config.size, zones)
|
||||||
|
Loading…
Reference in New Issue
Block a user