Skip to content

Support for hugepages in KVM VMs #11120

Open
@akrasnov-drv

Description

@akrasnov-drv

The required feature described as a wish

We use hugepages and some other tweaks to optimize performance of KVM VMs.
I managed to use our KVM VM config in CloudStack by updating VM xml via hook.
The problem is that CloudStack checks free memory of Linux and ignores free hugepages.
As I understand, in the earlier version of CloudStack it used shell to get free memory info, but now it uses Java calls that I can't change without patching and rebuilding agent code.

The following changes should do what I miss:
I'd like to have config option (in Cloudstack config, or in agent.properties) to enable hugepages (defaults to off). IMHO, it's quite easy to do. The option will

  • add the following block to each KVM VM created
  <memoryBacking>
    <hugepages/>
  </memoryBacking>
  • change check of free memory from MemFree to HugePages_Free × Hugepagesize

Something like the following

long hpFree  = map.getOrDefault(HUGEPAGE_FREE_KEY, 0L);
    long hpSize  = map.getOrDefault(HUGEPAGE_SIZE_KEY, 1024L);  // KiB
    return (hpFree * hpSize) + memFree;

Another option, though less preferable, is to allow using external script (e.g. host.stats.command.script) to override internally acquired values (e.g. MemFree)

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions