HugePages is a feature integrated into the Linux kernel with release 2.6. This feature basically provides the alternative to the 4K page size (16K for IA64) providing bigger pages. HugePages is a method to have larger pages where it is useful for working with very large memory.


Configure hugepages by using the kernel tunable vm.nr_hugepages


1. Edit /etc/sysctl.conf file and specify the number of hugepages in the nr_hugepages parameter. The entry makes the parameter persist across reboots but does not come into effect until you run the ‘sysctl -p’ command described in the next step.

# vi /etc/sysctl.conf
vm.nr_hugepages = 10


2. Execute ‘sysctl -p’ command to enable the hugepages parameter.

# sysctl -p
vm.nr_hugepages = 10


Note: It’s recommended to restart the system after configuring hugepages as the chances of having free contiguous memory (for hugepages allocation) is much greater when a system is started.




To verify the hugepages parameter setting, use either for the 2 methods given below:

1. check for the file /proc/meminfo :

# cat /proc/meminfo | grep Huge
HugePages_Total:    10
HugePages_Free:     10
HugePages_Rsvd:      0
Hugepagesize:     2048 kB



HugePages_Total – the size of the pool of huge pages.

HugePages_Free – the number of huge pages in the pool that are not yet used.

HugePages_Rsvd – the number of huge pages committed to be allocated from the pool but no allocation has yet been made.

HugePages_Surp – is short for “surplus,” and is the number of huge pages in the pool above the value in /proc/sys/vm/nr_hugepages. The maximum number of surplus huge pages is controlled by /proc/sys/vm/nr_overcommit_hugepages.


2. Use the sysctl command :

# sysctl a | grep nr_hugepages
vm.nr_hugepages = 10


How to calculate hugepages


Used hugepages can be calculated by below method. Use the values from the outpur of ‘cat /proc/meminfo’ in the formula below.

HugePages_Total - HugePages_Free = HugePages_Used


Was this answer helpful? 0 Users Found This Useful (0 Votes)