# calculate vm.nr_hugepages (128Gb mem minus 5% for system:
# echo $((128*1024/2/100*95))
# 62225
vm.nr_hugepages = 62225
#
# memlock calculate:
# grep Hugepagesize /proc/meminfo
# Hugepagesize:     2048 kB
# echo $((62225*2048))
# 127436800
# /etc/security/limits.conf:
# qemu           soft    memlock         127436800
# qemu           hard    memlock         127436800
#
# determine vm.hugetlb_shm_group:
# cat /etc/passwd | grep "qemu"
# qemu:x:107:107:qemu user:/:/sbin/nologin
vm.hugetlb_shm_group = 107
#
# calculate kernel.shmall for 128Gb mem minus 5% for system:
# getconf PAGE_SIZE
# 4096
# echo $((128*1024*1024*1024/100*95/4096))
# 31876710
kernel.shmall = 31876710
#
# calculate kernel.shmall for 128Gb mem minus 5% for system:
# echo $((128*1024*1024*1024/100*95))
kernel.shmmax = 130567005730