Disabling Transparent HugePages in RHEL7.x

Environment
[root@lab-12cr2 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)

Runtime Disable THP
Append below lines in /etc/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
Make sure that rc.local is running on reboot
chmod +x /etc/rc.d/rc.local
systemctl enable rc-local
systemctl status rc-local

Check the behavior on post reboot the operating system

[root@lab-12cr2 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[root@lab-12cr2 ~]#
[root@lab-12cr2 ~]# cat /sys/kernel/mm/transparent_hugepage/defrag
always madvise [never]
[root@lab-12cr2 ~]#
[root@lab-12cr2 ~]# grep -i HugePages_Total /proc/meminfo
HugePages_Total: 0
[root@lab-12cr2 ~]# cat /proc/sys/vm/nr_hugepages
0
[root@lab-12cr2 ~]# grep -i AnonHugePages /proc/meminfo
AnonHugePages: 2048 kB

Permanent Disable THP
Oracle Linux 7 is similar, but uses GRUB2 so you need to edit the “/boot/grub2/grub.cfg” file using the grubby command.
[root@lab-12cr2 ~]# grubby –default-kernel
/boot/vmlinuz-3.10.0-123.el7.x86_64
[root@lab-12cr2 ~]# grubby –args=”transparent_hugepage=never” –update-kernel /boot/vmlinuz-3.10.0-123.el7.x86_64
[root@lab-12cr2 ~]# grubby –info /boot/vmlinuz-3.10.0-123.el7.x86_64
index=0
kernel=/boot/vmlinuz-3.10.0-123.el7.x86_64
args=”ro rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet LANG=en_US.UTF-8 transparent_hugepage=never”
root=UUID=8190d97a-a2e9-44cd-9810-804def1d6f89
initrd=/boot/initramfs-3.10.0-123.el7.x86_64.img
title=Red Hat Enterprise Linux Server, with Linux 3.10.0-123.el7.x86_64
[root@lab-12cr2 ~]#

[root@lab-12cr2 ~]# grep -i “transparent_hugepage=never” /boot/grub2/grub.cfg
linux16 /vmlinuz-3.10.0-123.el7.x86_64 root=UUID=8190d97a-a2e9-44cd-9810-804def1d6f89 ro rd.lvm.lv=rhel/root crashkernel=auto rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us rhgb quiet LANG=en_US.UTF-8 transparent_hugepage=never
[root@lab-12cr2 ~]# grep -i AnonHugePages /proc/meminfo
AnonHugePages: 0 kB
[root@lab-12cr2 ~]#
[root@lab-12cr2 ~]# grep -i HugePages_Total /proc/meminfo
HugePages_Total: 0
[root@lab-12cr2 ~]# cat /proc/sys/vm/nr_hugepages
0

Reference
Oracle MetaLink ALERT: Disable Transparent HugePages on SLES11, RHEL6, RHEL7, OL6, OL7 and UEK2 Kernels (Doc ID 1557478.1)

https://oracle-base.com/articles/linux/configuring-huge-pages-for-oracle-on-linux-64#disabling-transparent-hugepages

http://docs.oracle.com/database/122/LADBI/disabling-transparent-hugepages.htm#LADBI-GUID-02E9147D-D565-4AF8-B12A-8E6E9F74BEEA

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s