Site icon CentLinux

How to disable Transparent Huge Pages in RHEL 8

Share on Social Media

Learn how to disable Transparent Huge Pages in RHEL 8 with our step-by-step guide. Optimize your system performance by following our instructions to turn off Transparent Huge Pages safely and effectively. #centlinux #linux #linuxtips

What are Transparent Huge Pages?

Transparent Huge Pages (THP) are a feature in the Linux kernel that aims to improve system performance by using larger memory pages, known as huge pages or large pages. These larger page sizes can reduce the overhead associated with managing memory pages, leading to improved performance, especially for memory-intensive workloads like databases.

Key points about Transparent Huge Pages (THP):

In summary, Transparent Huge Pages (THP) are a kernel feature in Linux that leverages larger memory pages to improve system performance, especially for memory-intensive workloads. However, their effectiveness can vary depending on the workload and system configuration.

Recommended Online Training: Learn Bash Shell in Linux for Beginners

Disable Transparent Huge Pages

Check the current status of Transparent Huge Pages.

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

THP are currently enabled in your Linux operating system.

To disable Transparent Huge Pages, you have to edit GRUB boot menu. For this purpose, edit the GRUB configuration file in vim text editor.

# vi /etc/default/grub

Locate GRUB_CMDLINE_LINUX and append “transparent_hugepage=never” at the end of that line.

GRUB_CMDLINE_LINUX="resume=/dev/mapper/cl-swap rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet transparent_hugepage=never"

Generate new GRUB boot menu based on customized configuration file.

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
done

Restart Linux operating system to apply new settings.

# reboot

After restart, check the status of THP again.

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

You have disabled Transparent Huge Pages on your Linux operating system. But you are also required to configure tuned service as well.

Create a Custom Profile for tuned Service

tuned service is used for monitoring and tuning in a Linux system. It can be used to disable or enable THP.

Therefore, you need to create a profile for tuned service and disable the Transparent Huge Pages in that profile.

Create a directory for new tuned profile.

# mkdir /etc/tuned/no-thp

Create a tuned configuration file.

# vi /etc/tuned/no-thp/tuned.conf

Add following lines in that file.

[main]
include=virtual-guest

[vm]
transparent_hugepages=never

Enable the no-thp profile by using following command.

# tuned-adm profile no-thp

If this information is too much technical for you, then you should buy and read Practical Guide to Linux Commands, Editors, and Shell Programming (PAID LINK) by Mark Sobell & Matthew Helmke

Final Thoughts

Disabling Transparent Huge Pages (THP) in RHEL 8 can be a critical step in optimizing system performance for certain workloads. By following our guide, you can safely and effectively disable THP to fine-tune your system for better performance. If you need personalized assistance or encounter any challenges during the process, I offer professional services on Fiverr. Check out my Fiverr gig for expert help with optimizing your RHEL 8 system and other Linux-related tasks.

Exit mobile version