Disabling Transparent HugePages On RHEL 7

Transparent HugePages (THP) memory is different from standard HugePages memory because the kernel thread allocates memory dynamically during runtime. Standard HugePages memory is pre-allocated at startup, and does not change during runtime. This dynamic memory allocation of THP can cause memory allocation delays during runtime. To avoid performance issues, Oracle recommends that you disable THP on all Oracle Database servers. Oracle recommends that you instead use standard HugePages for enhanced performance.

Step #1 – Check Current THP Status

Transparent Huge Pages is currently set to “always”, meaning that is is enabled.

# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

Step #2 – Disable THP

Disable transparent huge pages persistently across reboots by appending the GRUB_CMDLINE_LINUX (kernel boot command line) within the /etc/default/grub with “transparent_hugepage=never”. Refer to the example below:

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="rd.lvm.lv=myvg/swap rd.lvm.lv=myvg/usr vconsole.font=latarcyrheb-sun16 rd.lvm.lv=myvg/root crashkernel=auto vconsole.keymap=us rhgb quiet transparent_hugepage=never"

Step #3 – Source Grub Changes

For the grub changes to take effect, run the following command: 

# grub2-mkconfig -o /boot/grub2/grub.cfg

Step #4 – Reboot Host And Confirm

Reboot the server. After reboot, verify that THP is now disabled via the following command:

# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]