Is there a way to permanently reserve a contiguous area of memory only for a VM’s hugepages?

I have a CPU with numa nodes and assign a VM hugepages specifically from a particular node (also pinned to cores of that node). Is there a way to keep the kernel from assigning anything else to that memory area?

Currently if the VM isn’t started on system startup or is shut down for too long, then something else will eventually grab bits of that memory area causing the hugepages allocation to fail. This requires a reboot to fix.

Alternatively, is there a way to force everything else off into another memory area without a reboot?

Should be able to use sysctl to set how much you want reserved as hugepages on boot

2 Likes