Configuring HugeTLB Pages by Using Kernel Parameters at Boot Time

Use the grubby command to configure kernel command line options that the system uses at boot time to set up HugeTLB pages.

The following procedure shows how to set default kernel command line options in the GRUB 2 configuration to specify two pools of HugeTLB pages and a default page size on a system that handles multiple huge page sizes. In this procedure, the following are requested:
  • A default page size of 1 GB.
  • One pool with four HugeTLB pages of 1 GB size.
  • One pool of 1500 HugeTLB pages of 2 MB size.

Before beginning the following procedure, ensure that you have the administrative privileges required.

For more information about configuring kernel command line options and GRUB 2 see Oracle Linux 10: Managing Kernels and System Boot .

  1. Use the grubby command to add the kernel command line arguments that you require.

    For example, specify 1 GB size for kernel boot parameter default_hugepagesz and 2 pairs of "hugepagesz=<Size_num>G hugepages=Qty_num" parameters for the two huge page pools.

    sudo grubby --update-kernel=ALL --args="default_hugepagesz=1G hugepagesz=1G hugepages=4 hugepagesz=2M hugepages=1500"

    By using the ALL keyword when using grubby to update the kernel, the changes are applied to all kernels and the /etc/default/grub configuration file is also updated.

  2. Validate that the configuration is updated.
    sudo grubby --info ALL
  3. Reboot the system for the changes to take effect.
  4. Verify that the new configuration is in effect on the system.
    cat /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages
    cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages