mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-02 11:35:46 +00:00
vmm: Add 'host_numa_nodes' option to memory zones
Since memory zones have been introduced, it is now possible for a user to specify multiple backends for the guest RAM. By adding a new option 'host_numa_node' to the 'memory-zone' parameter, we allow the guest RAM to be backed by memory that might come from a specific NUMA node on the host. The option expects a node identifier, specifying which NUMA node should be used to allocate the memory associated with a specific memory zone. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
ad5d0e4713
commit
e6f585a31c
@ -120,7 +120,7 @@ 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\"",
|
shared=on|off,hugepages=on|off,host_numa_node=<node_id>\"",
|
||||||
)
|
)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.min_values(1)
|
.min_values(1)
|
||||||
|
@ -467,6 +467,8 @@ components:
|
|||||||
hugepages:
|
hugepages:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: false
|
default: false
|
||||||
|
host_numa_node:
|
||||||
|
type: uint64
|
||||||
|
|
||||||
MemoryConfig:
|
MemoryConfig:
|
||||||
required:
|
required:
|
||||||
|
@ -352,6 +352,8 @@ pub struct MemoryZoneConfig {
|
|||||||
pub shared: bool,
|
pub shared: bool,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub hugepages: bool,
|
pub hugepages: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
pub host_numa_node: Option<u64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
|
||||||
@ -431,7 +433,8 @@ impl MemoryConfig {
|
|||||||
.add("size")
|
.add("size")
|
||||||
.add("file")
|
.add("file")
|
||||||
.add("shared")
|
.add("shared")
|
||||||
.add("hugepages");
|
.add("hugepages")
|
||||||
|
.add("host_numa_node");
|
||||||
parser.parse(memory_zone).map_err(Error::ParseMemoryZone)?;
|
parser.parse(memory_zone).map_err(Error::ParseMemoryZone)?;
|
||||||
|
|
||||||
let size = parser
|
let size = parser
|
||||||
@ -450,12 +453,16 @@ impl MemoryConfig {
|
|||||||
.map_err(Error::ParseMemoryZone)?
|
.map_err(Error::ParseMemoryZone)?
|
||||||
.unwrap_or(Toggle(false))
|
.unwrap_or(Toggle(false))
|
||||||
.0;
|
.0;
|
||||||
|
let host_numa_node = parser
|
||||||
|
.convert::<u64>("host_numa_node")
|
||||||
|
.map_err(Error::ParseMemoryZone)?;
|
||||||
|
|
||||||
zones.push(MemoryZoneConfig {
|
zones.push(MemoryZoneConfig {
|
||||||
size,
|
size,
|
||||||
file,
|
file,
|
||||||
shared,
|
shared,
|
||||||
hugepages,
|
hugepages,
|
||||||
|
host_numa_node,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some(zones)
|
Some(zones)
|
||||||
|
@ -364,6 +364,7 @@ impl MemoryManager {
|
|||||||
file: None,
|
file: None,
|
||||||
shared: config.shared,
|
shared: config.shared,
|
||||||
hugepages: config.hugepages,
|
hugepages: config.hugepages,
|
||||||
|
host_numa_node: None,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
(config.size, zones)
|
(config.size, zones)
|
||||||
|
Loading…
Reference in New Issue
Block a user