Hugepage amount configuration on RHEL7 with Hugepagesize 1GB

Latest response

I am quite new to this topic so please excuse me if I am asking quite obvious things. My current RHEL7 comes with an Hugepagesize = 2048 kB and zero HugePages like this:

HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB

The system allows me freely to modify the amount of HugePages to any value xx on the fly with either of these two options:

echo xx > /proc/sys/vm/nr_hugepages
sysctl -w vm.nr_hugepages=xx

Now I added the following kernel boot parameters to grub to boot the system with 32 HugePages of 1GB:

cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-123.el7.x86_64 root=UUID=38b95071-ece4-49c3-b062-bd8a188e95cd ro crashkernel=auto rd.lvm.lv=vg00/root rd.lvm.lv=vg00/swap crashkernel=auto vconsole.font=latarcyrheb-sun16 vconsole.keymap=fi rhgb quiet default_hugepagesz=1GB hugepagesz=1GB hugepages=32

AnonHugePages: 4687872 kB
HugePages_Total: 32
HugePages_Free: 32
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 1048576 kB

After that I can not use echo nor sysctl anymore to modify the amount of HugePages:

sysctl -w vm.nr_hugepages=34
sysctl: setting key "vm.nr_hugepages": Invalid argument
vm.nr_hugepages = 34

echo 34 > /proc/sys/vm/nr_hugepages
-bash: echo: write error: Invalid argument

Does this happen because the amount of HugePages has to be set during boot in case of 1GB HugePages caused by the possible memory fragmentation issue? The issue is a bit annoying for me as in this case any modification of the amount of HugePages would require a server reboot. Anybody here got an answer to this?

Responses