GitHub user akrasnov-drv closed a discussion: Support for hugepages in KVM VMs

### 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`)

GitHub link: https://github.com/apache/cloudstack/discussions/11187

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to