From 04d034a0bc674d5738c031e42629b8329067b598 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 7 Nov 2022 16:27:06 +0000 Subject: [PATCH] docs: Update memory.md for THP Signed-off-by: Rob Bradford --- docs/memory.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/memory.md b/docs/memory.md index 431abbb70..dcae83ab7 100644 --- a/docs/memory.md +++ b/docs/memory.md @@ -20,12 +20,13 @@ struct MemoryConfig { hugepages: bool, hugepage_size: Option, prefault: bool, + thp: bool zones: Option>, } ``` ``` ---memory Memory parameters "size=,mergeable=on|off,shared=on|off,hugepages=on|off,hugepage_size=,hotplug_method=acpi|virtio-mem,hotplug_size=,hotplugged_size=,prefault=on|off" [default: size=512M] +--memory Memory parameters "size=,mergeable=on|off,shared=on|off,hugepages=on|off,hugepage_size=,hotplug_method=acpi|virtio-mem,hotplug_size=,hotplugged_size=,prefault=on|off,thp=on|off" [default: size=512M,thp=on] ``` ### `size` @@ -177,6 +178,25 @@ _Example_ --memory size=1G,prefault=on ``` +### `thp` + +Specifies if private anonymous memory for the guest (i.e. `shared=off` and no +backing file) should be labelled `MADV_HUGEPAGE` with `madvise(2)` indicating +to the kernel that this memory may be backed with huge pages transparently. + +The use of transparent huge pages can improve the performance of the guest as +there will fewer virtualisation related page faults. Unlike using +`hugepages=on` a specific number of huge pages do not need to be allocated by +the kernel. + +By default this option is turned on. + +_Example_ + +``` +--memory size=1G,thp=on +``` + ## Advanced Parameters `MemoryZoneConfig` or what is known as `--memory-zone` from the CLI perspective