How to change hugepages in Openstack compute nodes

Dear friends, today we will see how to change hugepages in openstack compute nodes. We will also see what is hugepages and islocpus? So, let’s start and see steps by steps this process.

What is hugepages in openstack?

Physical memory is segmented into a series of contiguous regions called pages. Each page contains a number of bytes, referred to as the page size. The system retrieves memory by accessing entire pages, rather than byte by byte.

The standard page size in x86 systems is 4 kB. This is optimal for general purpose computing but larger page sizes – 2 MB and 1 GB – are also available. These larger page sizes are known as huge pages.

For more details about Hugepage you can Click-Here

Change Hugepages and isolcpus steps.

In this tutorial I am going to change hugepages from 2MB to 1GB in AVRS compute nodes.

Verify the current hugepagesz configuration

You can see in below output, currently we have 2M hugegpagez. Now we need to be change 2M hugepagesz to 1G hugepagesz.

[root@overcloud-avrscompute-3 ~]# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-3.10.0-862.9.1.el7.x86_64 root=UUID=c945782b-90ac-4a62-91f5-3311d3fd2533 ro console=tty0 console=ttyS0,115200n8 crashkernel=auto rhgb quiet LANG=en_US.UTF-8 iommu=pt default_hugepagesz=2M hugepagesz=2M hugepages=134899 intel_iommu=on

Check the current grub file

We can check current grub configuration using below commands.

salt '*avrscompute*' cmd.run "sudo cat /etc/default/grub"

Take a backup of current grub file

Before any changes in grub, please make sure you have taken grub file backup. You can use this below commands to take a backup of grub file.

salt '*avrscompute*' cmd.run "sudo cp -rp /etc/default/grub /etc/default/grub-bkp"

Verify the backup file is present or not

Verify the backup using below commands.

salt '*avrscompute*' cmd.run "sudo ls -l /etc/default/grub*

Change hugepages and isolcpus

To change the hugepagesz = 1G, hugepages=242  and isolcpus=3-39,43-79  run this bellow command.

salt '*avrscompute*' cmd.run "sed -i 's/^\\(GRUB_CMDLINE_LINUX\\).*/\\1=\"console=tty0 console=ttyS0,115200n8 crashkernel=auto rhgb quiet LANG=en_US.UTF-8 iommu=pt default_hugepagesz=1G hugepagesz=1G hugepages=242 isolcpus=3-39,43-79 intel_iommu=on\"/' '/etc/default/grub'"
Change hugepages

Verify the changes are applied or not in grub file?

We can verify the grub changes is completed or not, using below commands.

salt '*avrscompute*' cmd.run "sudo cat /etc/default/grub"
Change Hugepages

Run this command to re-generate the /boot/grub2/grub.cfg file

If there are any changes in /etc/default/grub file, then you must run grub2-mkconfig to re-generate the /boot/grub2/grub.cfg file.

salt '*avrscompute*' cmd.run "sudo grub2-mkconfig -o /boot/grub2/grub.cfg"
Change hugepages

Reboot the all AVRS nodes

After grub changes, we can reboot the compute nodes using below commands.

salt '*avrscompute*' cmd.run "sudo reboot"
change hugepages

Verify the changes after compute reboot

Once computes nodes properly up then we can verify hugespage has been changed or not using below commands.

salt '*avrscompute*' cmd.run "sudo cat /proc/cmdline"
change hugepage

We can also check hugepages size using below command.

salt '*avrscompute*' cmd.run "sudo cat /proc/meminfo |grep Huge"
Change hugepages

You can see in above screen shot. We have successfully change hugepages in AVRS compute nodes.

You can also see how to set hugepages in flavor through below link.

Extra Specs set in openstack flavor using CLI

Leave a Reply