Disabling THP (Transparent Huge Page) on Xeon V5 Machines

3 min

language: ja bn en es hi pt ru zh-cn zh-tw

Hello, I'm Munou.

I was looking at the RHEL release notes and found something interesting.

https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/9/html-single/9.3_release_notes/index#new-features

>Improved performance of string and memory routines on Intel® Xeon® v5 based hardware in glibc

>Previously, the default amount of cache used by glibc for string and memory routines caused performance to be lower than expected on Intel® Xeon® v5 based systems. This update adjusts the amount of cache used to improve performance.

https://bugzilla.redhat.com/show_bug.cgi?id=2180462

>The customer’s system did boot with mitigations=off, and with transparent_hugepages (THP) disabled. Neither are needed to reproduce this problem, but disabling THP does enable the simple memcpy reproducer to achieve much higher performance.

It seems that RHEL 9.3 is also adjusting this cache amount, and since I also saw that Redis's recommended environment is to turn off THP, I will try turning it off.

Check the current settings below.

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

It's running. It seems that 2MB is allocated by default.

$ sudo cat /proc/meminfo | grep “Hugepagesize”
Hugepagesize:       2048 kB

I'll switch to the root user and try turning it off.

$ echo never > /sys/kernel/mm/transparent_hugepage/enabled

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

I'll write it in rc.local so it turns off at startup.

vi /etc/rc.local

and add to the beginning

echo never > /sys/kernel/mm/transparent_hugepage/enabled

---

I somehow feel that both memory and CPU usage have decreased significantly.

Well, it's highly likely to be my imagination, but I won't know until I use it.
That's all for now.

Thank you again.

Related Posts