Bug 1189868 - Disabling Transparent Hugepages persistently via kernel boot command line not working
Disabling Transparent Hugepages persistently via kernel boot command line not...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tuned (Show other bugs)
7.2
x86_64 Linux
medium Severity medium
: rc
: 7.2
Assigned To: Jaroslav Škarvada
Tereza Cerna
:
: 1195656 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-02-05 11:52 EST by rlopez
Modified: 2015-11-19 07:21 EST (History)
7 users (show)

See Also:
Fixed In Version: tuned-2.5.0-1.el7
Doc Type: Bug Fix
Doc Text:
Cause: Previously the transparent_hugepages wasn't handled the optimal way in Tuned. Consequence: If user explicitly specified transparent_hugepage settings in kernel command line, the settings could be overwritten by Tuned. Fix: Handling of transparent_hugepages was improved in Tuned. Result: Kernel boot command line is now checked by Tuned and if transparent_hugepage settings is specified there, the setting from Tuned profile is ignored. Also transparent_hugepages was removed from the throughput-performance profile, because it is now not needed there. Finally support for 'madvise' transparent_hugepages setting was added into Tuned.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-19 07:21:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description rlopez 2015-02-05 11:52:13 EST
Description of problem:
Disabling transparent huge pages persistently across reboots by adding to the kernel boot command line within the /etc/default/grub and adding 'transparent_hugepage=never' within the GRUB_CMDLINE_LINUX is not working.

my grub file:

cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
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"
GRUB_DISABLE_RECOVERY="true"

grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-123.6.3.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.6.3.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-17255126fcb14a469742d9f2ba9a1088
Found initrd image: /boot/initramfs-0-rescue-17255126fcb14a469742d9f2ba9a1088.img
done

Reboot the system, once the system is back up

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

How reproducible:
100%

Am I doing something wrong? This is my understanding on persistently setting transparent hugepages off persistently
Comment 2 Peter Jones 2015-03-12 13:59:53 EDT
Can you show us /proc/cmdline after you've done this?  If that option is there, then this is probably a kernel problem rather than a grub2 related issue.
Comment 3 rlopez 2015-03-13 09:33:49 EDT
(In reply to Peter Jones from comment #2)
> Can you show us /proc/cmdline after you've done this?  If that option is
> there, then this is probably a kernel problem rather than a grub2 related
> issue.

Peter,

After reboot,

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

# cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-3.10.0-123.el7.x86_64 root=UUID=32e374f8-83ba-479e-a4bb-80d4f34516a7 ro rd.lvm.lv=myvg/rootvol vconsole.keymap=us vconsole.font=latarcyrheb-sun16 crashkernel=auto rhgb quiet transparent_hugepage=never
Comment 4 rlopez 2015-03-13 09:39:08 EDT
(In reply to rlopez from comment #3)
> (In reply to Peter Jones from comment #2)
> > Can you show us /proc/cmdline after you've done this?  If that option is
> > there, then this is probably a kernel problem rather than a grub2 related
> > issue.
> 
> Peter,
> 
> After reboot,
> 
> # cat /sys/kernel/mm/transparent_hugepage/enabled 
> [always] madvise never
> 
> # cat /proc/cmdline 
> BOOT_IMAGE=/vmlinuz-3.10.0-123.el7.x86_64
> root=UUID=32e374f8-83ba-479e-a4bb-80d4f34516a7 ro rd.lvm.lv=myvg/rootvol
> vconsole.keymap=us vconsole.font=latarcyrheb-sun16 crashkernel=auto rhgb
> quiet transparent_hugepage=never

To add, I have another system with RHEL 7.1 and I see it there too. See below.

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

# cat /proc/cmdline 
BOOT_IMAGE=/vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/myvg-rootvol ro rd.lvm.lv=myvg/rootvol vconsole.keymap=us vconsole.font=latarcyrheb-sun16 crashkernel=auto rhgb quiet transparent_hugepage=never LANG=en_US.UTF-8
Comment 5 Jeremy Eder 2015-03-13 11:51:45 EDT
This is because of RHEL7's default tuned profile "throughput-performance".

Removing it from the tuned profile would prevent tuned from overriding the kernel cmdline option as specified by the user.

This change will have no performance impact, as the kernel's default is transparent_hugepages=always and all we are fixing here is to have tuned not override cmdline setting if it were set by the user.  Since the kernel enables THP by default, transparent_hugepage=always is redundant in tuned.

Verifying there really is only one profile that should be fixed:

# rpm -q tuned
tuned-2.4.1-1.el7.noarch

# grep -ri 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

It's only the throughput-latency profile that we need to fix, because we specifically want THP disabled for network latency sensitive workloads.

Patch against upstream tuned:

# git diff
diff --git a/profiles/throughput-performance/tuned.conf b/profiles/throughput-performance/tuned.conf
index 42473a9..4d6c607 100644
--- a/profiles/throughput-performance/tuned.conf
+++ b/profiles/throughput-performance/tuned.conf
@@ -7,9 +7,6 @@ governor=performance
 energy_perf_bias=performance
 min_perf_pct=100
 
-[vm]
-transparent_hugepages=always
-
 [disk]
 readahead=>4096





Until we ship an errata, the workaround is to create a tuned profile like so:

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

[vm]
transparent_hugepages=never

# systemctl restart tuned

# cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/vg0-root ro rd.md=0 rd.dm=0 rd.lvm.lv=vg0/swap console=ttyS0,115200 rd.lvm.lv=vg0/root rd.luks=0 vconsole.keymap=us vconsole.font=latarcyrheb-sun16 audit=0 transparent_hugepage=never

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

# tuned-adm profile thp
# cat /sys/kernel/mm/transparent_hugepage/enabled 
always madvise [never]
Comment 8 Jeremy Eder 2015-04-17 08:51:49 EDT
*** Bug 1195656 has been marked as a duplicate of this bug. ***
Comment 9 Jaroslav Škarvada 2015-06-26 07:56:19 EDT
Upstream commit fixing this issue:
https://git.fedorahosted.org/cgit/tuned.git/commit/?id=e2f86d412f598838630b30350a08e5befbad7ea3

It removes transparent_hugepages from throughput-performance profile.

It adds check for kernel boot cmdline, if there is transparent_hugepage already set, profile settings are ignored.

And finally it adds support for 'madvise' transparent_hugepages setting.
Comment 12 errata-xmlrpc 2015-11-19 07:21:17 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2375.html

Note You need to log in before you can comment on or make changes to this bug.