Thursday, 22 October 2015

How to disable Transparent HugePages or THP on Ol7/RHEL7/CENTOS 7?

Verify the THP mode

# uname -r
3.10.0-229.el7.x86_64
# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<THP is enabled 

Disable it on throughput-performance active profile

 Take a backup of "/usr/lib/tuned/throughput-performance/tuned.conf", then proceed for changes. 
 # cp /usr/lib/tuned/throughput-performance/tuned.conf /usr/lib/tuned/throughput-performance/tuned.conf.bkp_original
 # vi /usr/lib/tuned/throughput-performance/tuned.conf
  [vm]
   transparent_hugepages=always

   to 

  [vm]
  transparent_hugepages=never
  :wq 
  Reboot the server and verify the outcome.    
#uname -r
3.10.0-229.el7.x86_64
#cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<THP Disabled

Disable it on other active tuned profile

 First Identify which profile is active.     
# tuned-adm active
 Current active profile: virtual-guest <<<<<<<<virtual-guest is the active profile
  
Virtual-guest profile use this file "/usr/lib/tuned/virtual-guest/tuned.conf" and it includes "throughput-performance" in the main section which actually takes the configuration from "/usr/lib/tuned/throughput-performance/tuned.conf ". 

Now edit "/usr/lib/tuned/virtual-guest/tuned.conf" file and append "transparent_hugepages=never"  to disable THP.   
#cp /usr/lib/tuned/virtual-guest/tuned.conf /usr/lib/tuned/virtual-guest/tuned.conf.bkp_original
#vi /usr/lib/tuned/virtual-guest/tuned.conf
[main]
include=throughput-performance
[vm]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<Append this two lines to disable the THP on the virtual-guest profile.
transparent_hugepages=never
:wq
  Reboot the server and verify the outcome.

#uname -r
3.10.0-229.el7.x86_64
#cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<THP Disabled