How do I set up hugepages in Red Hat Enterprise

How do I set up hugepages in Red Hat Enterprise Linux 4?

by The editorial team

Contributed by Michael Kearey

Release Found: Red Hat Enterprise Linux 4



Hugepages can be allocated using the <tt class="command">/proc/sys/vm/nr_hugepages</tt> entry, or by using the <tt class="command">sysctl</tt> command.

To view the current setting using the <tt class="command">/proc</tt> entry:

# cat /proc/sys/vm/nr_hugepages

To view the current setting using the <tt class="command">sysctl</tt> command:

# sysctl vm.nr_hugepages
vm.nr_hugepages = 0

To set the number of huge pages using <tt class="command">/proc</tt> entry:

# echo 5 > /proc/sys/vm/nr_hugepages

To set the number of hugepages using <tt class="command">sysctl</tt> :

# sysctl -w vm.nr_hugepages=5
vm.nr_hugepages = 5

It may be necessary to reboot to be able to allocate all the hugepages that is needed. This is because hugepages requires large areas of contiguous physical memory. Over time, physical memory may be mapped and allocated to pages, thus the physical memory can become fragmented. If the hugepages are allocated early in the boot process, fragmentation is unlikely to have occurred.

It is recommended that the <tt class="command">/etc/sysctl.conf</tt> file should be used to allocate hugepages at boot time. For example, to allocate 5 hugepages at boot time add the line below to the <tt class="command">sysctl.conf</tt> file :

vm.nr_hugepages = 5

Red Hat’s customer service and support teams receive technical support questions from users all over the world. Red Hat technicians add the questions and answers to Red Hat Knowledgebase on a daily basis. Access to Red Hat Knowledgebase is free. Every month, Red Hat Magazine offers a preview into the Red Hat Knowledgebase by highlighting some of the most recent entries. The information provided in this article is for your information only. The origin of this information may be internal or external to Red Hat. While Red Hat attempts to verify the validity of this information before it is posted, Red Hat makes no express or implied claims to its validity.

This entry was posted by The editorial team on Tuesday, May 29th, 2007 at 10:47 am and is filed under tips and tricks. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.