Installation guide
# sysctl -w vm.nr_hugepages=512
To make the change permanent, append the following line to the /etc/sysctl.conf file as follows. This
file is used during the boot process. The Huge Pages pool is usually guaranteed if requested at boot time:
# echo "vm.nr_hugepages=512" >> /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, run:
$ grep HugePages_Total /proc/meminfo
HugePages_Total: 512
$
The output shows that 512 Huge Pages have been allocated. Since the size of Huge Pages 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 nr_hugepages, then the system either does
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 result in a better chance of getting the memory.
To get the number of free Huge Pages on the system, execute:
$ grep HugePages_Free /proc/meminfo
HugePages_Free: 512
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 such as Oracle DB or not.
In order to allow Oracle database server to use huge pages as its shared memory, you need to do two configura-
tion changes.
First, put group id of the Oracle instance (usually “dba”) into /proc/sys/vm/hugetlb_shm_group. You
can change this parameter dynamically:
# echo `id -g oracle` > /proc/sys/vm/hugetlb_shm_group
or assign the corresponding value to the vm.hugetlb_shm_group parameter in /etc/sysctl.conf.
The second change is related to the ulimit parameter memlock for the oracle user. It should be increased in
/etc/security/limits.conf if "max locked memory" is not unlimited or too small, see ulimit -a or
ulimit -l. For example:
oracle soft memlock 1048576
oracle hard memlock 1048576
The memlock parameter specifies how much memory the oracle user can lock into its address space. Note
that Huge Pages are locked in physical memory. The memlock setting is specified in KB and must match the
memory size of the number of Huge Pages that Oracle should be able to allocate. So if the Oracle database
should be able to use 512 Huge Pages, then memlock must be set to at least 512 * Hugepagesize, which
16 | www.redhat.com