Linux OS

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):

  • Memory Pages:
  • In computer memory management, memory is divided into fixed-size pages, typically 4 KB in size. These pages are the basic unit of memory allocation and management in the operating system.
  • Huge Pages:
  • Huge pages are memory pages that are larger than the standard page size. In Linux, huge pages can be 2 MB or 1 GB in size, compared to the standard 4 KB pages.
  • Transparent Huge Pages (THP):
  • THP is a kernel feature that allows the operating system to automatically manage the allocation and use of huge pages transparently to user-space applications.
  • THP dynamically allocates and manages huge pages based on system workload and memory usage patterns without requiring any changes to application code.
  • Performance Benefits:
  • Using larger pages can reduce the number of page table entries, TLB misses, and memory management overhead, leading to improved performance, especially for memory-intensive applications.
  • THP can benefit workloads such as databases, virtualization, and in-memory computing.
  • Configuration:
  • THP is enabled by default in many Linux distributions, including RHEL (Red Hat Enterprise Linux).
  • However, it can be controlled and configured using kernel parameters and system settings.
  • Considerations:
  • While THP can improve performance for some workloads, it may not provide significant benefits for all applications.
  • In some cases, THP may introduce latency or fragmentation issues, especially for certain database workloads.

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.

Alaric Bird

Alaric Bird is a seasoned Linux System Administrator with over a decade of experience in managing and optimizing Linux-based servers and infrastructure. Known for his expertise in server deployment, security hardening, and performance tuning, Alaric has a deep understanding of various Linux distributions, including Ubuntu, CentOS, and Red Hat Enterprise Linux. His skills extend to cloud platforms like AWS, where he effectively manages virtual private servers and services. Alaric is also proficient in scripting languages such as Bash and Python, which he uses to automate routine tasks, enhancing efficiency and reliability. With a strong commitment to continuous learning, he stays updated with the latest developments in open-source technologies and best practices. His problem-solving abilities, combined with excellent communication skills, make him a valuable asset to any IT team. In addition to his technical expertise, Alaric is passionate about mentoring junior administrators and fostering a collaborative environment.

Recent Posts

Puppy Linux: Fast and Simple OS

Puppy Linux is a fast, lightweight OS designed for speed and simplicity, perfect for old…

1 day ago

Change Apache Document Root in Linux

Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…

2 weeks ago

How to Change Apache Port in Linux

Discover how to change Apache port in Linux easily. Follow our simple guide to modify…

2 weeks ago

How to Create Virtual Host in Apache Server

Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…

3 weeks ago

10 Practical Tasks for RHCSA Exam with Solutions

Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…

3 weeks ago

Ultimate Fail2ban Configuration Guide

Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…

4 weeks ago

This website uses cookies.