Skip to content

VM Memory is only 4 KiB aligned #7968

@jaredwhitedev

Description

@jaredwhitedev

Describe the bug
A clear and concise description of what the bug is.

Without explicit huge pages, the VM memory is only aligned to 4 KiB. This means that the entire VM is likely to only get 4 KiB EPT entries, instead of 2 MiB or 1 GiB. This leads to reduced memory performance due to TLB pressure.

I have a PR to expose an option for alignment in vm-memory here: rust-vmm/vm-memory#375

To Reproduce
Steps to reproduce the behaviour:
Launch any VM with N GiB of memory, with or without THP. Observe that (unless you get lucky), /sys/kernel/debug/kvm/pages_2m is 0.

From looking at the code, I observed that QEMU and OpenVMM do align their memory.

Version

Output of cloud-hypervisor --version:
v51.1

Did you build from source, if so build command line (e.g. features):
No
VM configuration

What command line did you run (or JSON config data):
Launch a VM with a decent amount of memory (512 MiB, 1 GiB+), with THP but not explicit huge pages.

Guest OS version details:
https://github.com/cloud-hypervisor/linux

Host OS version details:
Observed on Azure Linux, Ubuntu 20, and Amazon Linux 3.

Logs
N/A, let me know if needed
Output of cloud-hypervisor -v from either standard error or via --log-file:

Linux kernel output:
Ditto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions