Disable Transparent Huge Pages(THP) persistently not working on RHEL7

Solution Verified - Updated

Environment

  • Red Hat Enterprise Linux (RHEL) 7
  • Prior to tuned-2.5.1-4.el7
  • Vmware Virtual Platform

Issue

  • Need assistance to disable Transparent Huge Pages(THP) persistently in RHEL7.
  • After disabling Transparent Huge Page, still see values on "HugePages" in /proc/meminfo which are expected to return 0.
$cat /proc/meminfo |grep HugePages
AnonHugePages:     81920 kB                
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB  

Resolution

Root Cause

  • This is because of RHEL7's default tuned profile "throughput-performance".
  • Tuned is running with "virtual-guest" and tuned package is older than tuned-2.5.1-4.el7.
$tuned-adm active  
Current active profile: virtual-guest

$rpm -qa |grep tuned
tuned-2.4.1-1.el7.noarch                                    Thu Feb 16 15:40:25 2017	
  • virtual-guest profile is inherited by throughput-performance profile so even after disabling THP when rebooting the system "transparent_hugepages=always " is applied.
$ grep transparent /usr/lib/tuned/*/*conf
usr/lib/tuned/network-latency/tuned.conf:transparent_hugepages=never
usr/lib/tuned/throughput-performance/tuned.conf:transparent_hugepages=always

Diagnostic Steps

  • Verify the version of tuned package.
$rpm -qa |grep tuned
  • Verify if "transparent_hugepage=never" is set on entry "GRUB_CMDLINE_LINUX" in /etc/default/grub.
$cat /etc/default/grub |grep GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root rhgb quiet transparent_hugepage=never"  
  • Check /proc/meminfo to see details related on "HugePages".
$cat /proc/meminfo
MemTotal:       16268544 kB
MemFree:        11469640 kB
MemAvailable:   14375384 kB
Buffers:           14896 kB
Cached:          2863688 kB
SwapCached:            0 kB
Active:          3553268 kB
Inactive:         627528 kB
Active(anon):    1304772 kB
Inactive(anon):     7088 kB
Active(file):    2248496 kB
Inactive(file):   620440 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:      16773116 kB
SwapFree:       16773116 kB
Dirty:              3232 kB
Writeback:             0 kB
AnonPages:       1301872 kB
Mapped:           195044 kB
Shmem:              9788 kB
Slab:             366444 kB
SReclaimable:     290224 kB
SUnreclaim:        76220 kB
KernelStack:       10624 kB
PageTables:        22412 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    24907388 kB
Committed_AS:    3130508 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      313924 kB
VmallocChunk:   34359412984 kB
HardwareCorrupted:     0 kB
AnonHugePages:     81920 kB               
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      161664 kB
DirectMap2M:    16615424 kB
  • Check current active profile
$ cat sos_commands/tuned/tuned-adm_active 
Current active profile: virtual-guest

$ grep include /usr/lib/tuned/virtual-guest/tuned.conf 
include=throughput-performance
SBR
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.