Enabling Hugepages at boot time on centos 7

8,679

Solution 1

It turns out the problem had to do with the location of the grub file, and the fact that I was using the wrong path for it.

I orignially tried to use

grub2-mkconfig -o /etc/grub2.cfg

But I should have used /boot/efi/EFI/centos/grub.cfg. as the path to the grub file. So the actual command should be

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

This is probably because it is a UEFI-based system. The Centos wiki states UFEI-based systems use a different path to the default grub file.

Solution 2

I was dealing with the same thing on CentOS 7.4.

Two things I noticed in your case:

  1. You have two entries for hugepagesz (1G and 2M) and hugepage (16 and 2048). I'm not sure whether you can do that.

  2. I generated the config file into /etc/grub2.cfg before reboot:

    grub2-mkconfig -o /etc/grub2.cfg
    

In my case, GRUB_CMDLINE_LINUX in /etc/default/grub has the following value (50 1G pages):

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet intel_iommu=on isolcpus=1,2,3,4,5,6,7,8,9,10,11 default_hugepagesz=1G hugepagesz=1G hugepages=50"

Also check whether your kernel has required options enabled (see DPDK manual, section 2.3.1 for these):

grep <OPTION>= /boot/config-`uname -r`

And check whether your CPU supports 1GB pages (searching for pdpe1gb cpu flag):

grep pdpe1gb /proc/cpuinfo

EDIT: Also check whether you mounted the memory properly (see DPDK manual, section 2.3.2.2).

Share:
8,679

Related videos on Youtube

esigenesis
Author by

esigenesis

Updated on September 18, 2022

Comments

  • esigenesis
    esigenesis almost 2 years

    I am trying to enable hugepages for use with ovs and DPDK on centos 7. I have tried to edit the GRUB_CMDLINE_LINUX in /etc/default/grub see code below. GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet hugepagesz=1G hugepages=16 hugepagesz=2M hugepages=2048 iommu=pt intel_iommu=on isolcpus=1-13,15-27"

    grub2-mkconfig -o /boot/grub2/grub.cfg :

    However after i reboot and issue the cat /proc/cmdline, the resulting output does not show appended hugepage entries. :-(

    [root@localhost ~]# cat /proc/cmdline

    enter image description here

    BOOT_IMAGE=/vmlinuz-3.10.0-327.36.3.el7.x86_64 root=/dev/mapper/centos-
    root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb
    quiet LANG=en_GB.UTF-8
    

    [root@localhost ~]# grep Huge /proc/meminfo :

    hugepages values

    Am i missing anything please?

    • derobert
      derobert over 7 years
      (A random troubleshooting step): Did the change make it to /boot/grub2/grub.cfg? (that's a plain text file, use less or your favorite editor to check)
    • esigenesis
      esigenesis over 7 years
      Hi @derobert thanks for the useful tip. the changes actually made it to /boot/grub2/grub.cfg. See output here **** linuxefi /vmlinuz-3.10.0-327.36.3.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet hugepagesz=1G hugepages=16 hugepagesz=2M hugepages=2048 iommu=pt intel_iommu=on isolcpus=1-13,15-27**** I am not sure why the hugepage values still come up with zero values after rebooting. Thanks