Sunday, July 16, 2023

Disabling Transparent Huge Pages on RHEL 8

 

What are Transparent Huge Pages? :

Transparent Huge Pages (THP) is a Linux memory management system that reduces the overhead of Translation Lookaside Buffer (TLB) lookups on machines with large amounts of memory by using larger memory pages.

Transparent Huge Pages are by default enabled in CentOS / RHEL 8.

Database workloads often perform poorly with THP enabled, because they tend to have sparse rather than contiguous memory access patterns.

Therefore, sometimes it is required that, you should disable Transparent Huge Pages on your Linux operating system.

 

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.

No comments:

Post a Comment