keephugepages doesn't work

Kodey

Active Member
Oct 26, 2021
130
6
38
When a vm with pre allocated hugepages is put to sleep, the memory isn't kept and it can no longer be booted after a while and backup fails too.
Normally, it runs fine from boot concerning huge pages and no issues present, but if I shutdown or sleep and leave it for some time, it won't restart.
qm[1123132]: start failed: hugepage allocation failed at /usr/share/perl5/PVE/QemuServer/Memory.pm line 541.
 
Code:
 grep -i huge /proc/meminfo
AnonHugePages:         0 kB
ShmemHugePages:        0 kB
FileHugePages:         0 kB
HugePages_Total:      64
HugePages_Free:       63
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:    1048576 kB
Hugetlb:        67108864 kB

I need a workaround to clear it so I don't need to reboot the host
 
Last edited:
You need to find out which process holds that one page.

edit:

Code:
grep huge /proc/*/numa_maps

should help
 
Last edited:
That helps
Code:
ps -f $(grep huge /proc/*/numa_maps | xargs -0 | sed -E 's/\/proc\/|\/numa_maps.*//g' | xargs )
UID          PID    PPID  C STIME TTY      STAT   TIME CMD
ctxroot    25151   14289  0 Aug31 ?        Ss     0:03 /usr/sbin/apache2 -k start
presta-+  354411   25151  0 10:00 ?        S      0:00 /usr/sbin/apache2 -k start
presta-+  354412   25151  0 10:00 ?        S      0:00 /usr/sbin/apache2 -k start
presta-+  354413   25151  0 10:00 ?        S      0:00 /usr/sbin/apache2 -k start
presta-+  354414   25151  0 10:00 ?        S      0:00 /usr/sbin/apache2 -k start
presta-+  354415   25151  0 10:00 ?        S      0:00 /usr/sbin/apache2 -k start

After I worked out which container it was and shut it down, I could boot the vm.

So why does this happen and how can I prevent it in the future?