vmm: Make Transparent Huge Pages controllable (default on)

Add MemoryConfig::thp and `--memory thp=on|off` to allow control of
Transparent Huge Pages.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2022-11-07 16:25:36 +00:00
parent b68add2d0d
commit f603afc46e
6 changed files with 32 additions and 4 deletions
+7
View File
@@ -139,6 +139,10 @@ impl Default for HotplugMethod {
}
}
fn default_memoryconfig_thp() -> bool {
true
}
#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)]
pub struct MemoryConfig {
pub size: u64,
@@ -160,6 +164,8 @@ pub struct MemoryConfig {
pub prefault: bool,
#[serde(default)]
pub zones: Option<Vec<MemoryZoneConfig>>,
#[serde(default = "default_memoryconfig_thp")]
pub thp: bool,
}
pub const DEFAULT_MEMORY_MB: u64 = 512;
@@ -177,6 +183,7 @@ impl Default for MemoryConfig {
hugepage_size: None,
prefault: false,
zones: None,
thp: true,
}
}
}