Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

14.6. Configuring Huge Pages in Red Hat Enterprise Linux 3

Before configuring Big Pages, ensure to have read Section 14.3, “Sizing Big Pages and Huge Pages”.
In Red Hat Enterprise Linux 3 the desired size of the Huge Pages pool is specified in megabytes. The size of the pool should be configured by the incremental size of the Huge Page size. To obtain the size of Huge Pages, execute the following command:
$ grep Hugepagesize /proc/meminfo
Hugepagesize:     2048 kB
The number of Huge Pages can be configured and activated by setting hugetlb_pool in the proc file system. For example, to allocate a 1GB Huge Page pool, execute:
# echo 1024 > /proc/sys/vm/hugetlb_pool
Alternatively, you can use sysctl(8) to change it:
# sysctl -w vm.hugetlb_pool=1024
To make the change permanent, add the following line to the file /etc/sysctl.conf. This file is used during the boot process. The Huge Pages pool is usually guaranteed if requested at boot time:
# echo "vm.hugetlb_pool=1024" >> /etc/sysctl.conf
If you allocate a large number of Huge Pages, the execution of the above commands can take a while. To verify whether the kernel was able to allocate the requested number of Huge Pages, execute:
$ grep HugePages_Total /proc/meminfo
HugePages_Total:   512 
The output shows that 512 Huge Pages have been allocated. Since the size of Huge Pages on this system is 2048 KB, a Huge Page pool of 1GB has been allocated and pinned in physical memory.
If HugePages_Total is lower than what was requested with hugetlb_pool, then the system does either not have enough memory or there are not enough physically contiguous free pages. In the latter case the system needs to be rebooted which should give you a better chance of getting the memory.
To get the number of free Huge Pages on the system, execute:
$ grep HugePages_Free /proc/meminfo
Free system memory will automatically be decreased by the size of the Huge Pages pool allocation regardless whether the pool is being used by an application like Oracle database or not being used:
$ grep MemFree /proc/meminfo
After an Oracle database starts up, verify the Huge Pages usage. The number of free Huge Pages should decrease.
$ grep HugePages_Free /proc/meminfo
To free the Huge Pages pool, you can execute:
# echo 0 > /proc/sys/vm/hugetlb_pool
This command usually takes a while to finish.