How to change the default HugePage size in Red Hat Enterprise Linux ?

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux 10
  • Red Hat Enterprise Linux 9
  • Red Hat Enterprise Linux 8
  • HugePage

Issue

  • How to change the default HugePage size in Red Hat Enterprise Linux ?
  • How to change the default HugePage size to 1GB on X86-64 platform?

Resolution

  • The kernel boot parameter default_hugepagesz is used to set the size of the default HugeTLB page.

RHEL 9 & RHEL 10

  • Execute the below command to set the default HugePage size to 1 GB.
# grubby --update-kernel=ALL --args="default_hugepagesz=1G"
  • Reboot the node.
# reboot
  • Verify the hugepages configuration.
# grep -i hugepagesize /proc/meminfo 
Hugepagesize:    1048576 kB

RHEL 8

  • Set default_hugepagesz=1G in /boot/grub2/grubenv file to change the default HugePage size to 1GB on X86-64 platform.
# grep kernelopts /boot/grub2/grubenv
kernelopts=root=/dev/mapper/rhel-root ro resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet default_hugepagesz=1G
  • Reboot the system for changes to take effect.
# reboot
  • Verify the default HugePage size using the following commands.
# grep Hugepagesize: /proc/meminfo 
Hugepagesize:    1048576 kB

# hugeadm --pool-list
      Size  Minimum  Current  Maximum  Default
1073741824        0        0        0        *
SBR
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.