RHEL7 – How to disable transparent hugepages (THP)

Method 1: Create a customized tuned profile with disabled THP

Step 1: Initially, we should create a customized version of the currently running profile. The customized version will disable THP. Find out which profile is active, create a copy. In the following example we currently use the throughput-performance profile:

# tuned-adm active

 Current active profile: throughput-performance

step 2: To create customized profile, create a new directory in /etc/tuned directory with desired profile name.

# mkdir /etc/tuned/myprofile-nothp

step #; Then create a new tuned.conf file for myprofile-nothp, and insert the new tuning info:

# cat /etc/tuned/myprofile-nothp/tuned.conf
[main]
include= throughput-performance

[vm]
transparent_hugepages=never

Step 4: Make the script executable:

# chmod +x /etc/tuned/myprofile-nothp/tuned.conf

step 5: Enable myprofile like so:

# tuned-adm profile myprofile-nothp

This change will immediately take effect and persist reboots.

step 6: Now follow the below steps to add “transparent_hugepage=never” kernel parameter in grub configuration file.
Append or change the “transparent_hugepage=never” kernel parameter on the GRUB_CMDLINE_LINUX option in /etc/sysconfig/grub file. Save the file.

GRUB_CMDLINE_LINUX=”rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap vconsole.font=latarcyrheb-sun16 vconsole.keymap=us transparent_hugepage=never”

step 7: Run the grub2-mkconfig command to regenerate the grub.cfg file:

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

Step 8: Reboot the system and ensure the changes are working as expected. This can also be confirmed by running this command:

# cat /proc/cmdline

Method 2:  Disable tuned services and modify GRUB

This resolution will disable the tuned services.

# systemctl stop tuned
#systemctl disable tuned

OR

# tuned-adm off

Now add “transparent_hugepage=never” kernel parameter in grub configuration file as explained if above first method.
Reboot the server for changes to take effect.

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

5 Responses

  1. unixbhaskar says:

    Good one!!

  2. andre says:

    This operation will set /sys/kernel/mm/transparent_hugepage/enabled to [never]. However this article doesn’t explain how to set [never] for /sys/kernel/mm/transparent_hugepage/defrag

  1. September 2, 2015

    […] RHEL7 – How to disable transparent hugepages (THP) […]

  2. September 4, 2015

    […] RHEL7 – How to disable transparent hugepages (THP) […]

  3. July 22, 2016

    […] Read – How to disable transparent hugepages (THP) in RHEL7 […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us