vmm: add per-zone mergeable option to --memory-zone - #7983
Conversation
|
aside from the test coverage, manual vm runs were performed under |
likebreath
left a comment
There was a problem hiding this comment.
Thank you for the contribution with clear documentation and disclosure of the use of LLMs.
|
You will need to fix the clippy issue and also rebase, so that we can land it. |
Add a `mergeable` field to `MemoryZoneConfig` so that KSM page merging can be enabled selectively per memory zone rather than globally for all guest RAM. Previously, `MADV_MERGEABLE` was only controllable via the top-level `--memory mergeable=on` flag, which applied uniformly to all regions. With this change, users can leave boot memory unmerged while enabling KSM only on hotplug zones: --memory size=0,hotplug_method=virtio-mem --memory-zone id=boot,size=512M,shared=on,mergeable=off --memory-zone id=hotplug,size=256M,hotplug_size=1G,shared=off,mergeable=on The `MemoryZone` runtime struct now carries the `mergeable` flag so that both `allocate_address_space` and `add_ram_region` can apply per-zone `MADV_MERGEABLE` instead of the global `self.mergeable`. The top-level `--memory mergeable=on` path continues to work unchanged: the default zone is synthesised from `MemoryConfig` and inherits its `mergeable` value. AI/LLM disclosure: this patch was co-authored with GitHub Copilot and Claude Code (Opus 4.6). Signed-off-by: JP Kobryn <[email protected]>
d6c9462 to
5dc7d61
Compare
|
rebased and fixed formatting. |
rbradford
left a comment
There was a problem hiding this comment.
Thank you! I was going to ask you to add mergeable to the OpenAPI definition file however it was already in there despite the struct missing it!
bdc7a69
Add a
mergeablefield toMemoryZoneConfigso that KSM page merging can be enabled selectively per memory zone rather than globally for all guest RAM.Previously,
MADV_MERGEABLEwas only controllable via the top-level--memory mergeable=onflag, which applied uniformly to all regions. With this change, users can leave boot memory unmerged while enabling KSM only on hotplug zones:--memory size=0,hotplug_method=virtio-mem
--memory-zone id=boot,size=512M,shared=on,mergeable=off
--memory-zone id=hotplug,size=256M,hotplug_size=1G,shared=off,mergeable=on
The
MemoryZoneruntime struct now carries themergeableflag so that bothallocate_address_spaceandadd_ram_regioncan apply per-zoneMADV_MERGEABLEinstead of the globalself.mergeable. The top-level--memory mergeable=onpath continues to work unchanged: the default zone is synthesised fromMemoryConfigand inherits itsmergeablevalue.AI/LLM disclosure: this patch was co-authored with GitHub Copilot and Claude Code (Opus 4.6).