Skip to content

How to fix Transparent Huge Pages (THP) are activated

October 23, 2023
SAP

Transparent Huge Pages (THP) is a feature that is generally activated for the Linux kernel shipped with SUSE Linux Enterprise Server (SLES) 11 and Red Hat Enterprise Linux (RHEL) 6 versions certified for usage with SAP ASE. Due to the special manner of SAP ASE’s memory management, using THP may lead to hanging situations and performance degradations.

Symptom-Transparent Huge Pages (THP)

You experience that your SAP ASE database does not react anymore, that the CPU load is high and/or severe performance issues occur. Additionally, Transparent Huge Pages are activated on your SAP ASE servers. Until further notice, SAP strongly recommends that you disable Transparent Huge Pages on all your SAP ASE servers.

Note
Transparent Huge Pages is supported on Intel-based hardware platforms only.
The following checks and steps should be performed on all hosts of the affected SAP ASE system. They have to be executed as the root user in the Linux shell.

Alert

Transparent Huge Pages (THP) are activated on <hostname>. CHECK_PLATFORM(‘CHECK_THP’).VALUE: “[always] madvise never”.

Transparent Huge Pages
Transparent Huge Pages

Solution: –

To check whether Transparent Huge Pages are activated and currently being used by processes, execute the below commands in the Linux shell:

  1. cat /sys/kernel/mm/transparent_hugepage/enabled
  2. cat /proc/meminfo | grep AnonHugePages
cat /sys/kernel/mm/transparent_hugepage/enabled
Transparent Huge Pages

If both steps show that Transparent Huge Pages are activated or in use, deactivate them by executing the commands below in the Linux shell:

  1. echo never > /sys/kernel/mm/transparent_hugepage/enabled
  2. cat /sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/enabled
Transparent Huge Pages

The first command will deactivate Transparent Huge Pages by setting the relevant Kernel parameter to “never”. Right after executing this command, the hanging situation will be resolved. You can verify whether the Kernel parameter has the correct value by executing the second command which should show the output “always madvise [never]” where the new value is in square brackets.

Note that unless the value of the Kernel parameter has not been persisted, it is only set/valid until the host is restarted the next time. To prevent toggling the value from [never] back to [always] causing THPs to be activated again, use one of the below strategies to persist it:

  1. Add the parameter “transparent_hugepage=never” to the kernel boot line in the /etc/grub.conf file of the Bootloader.
  2. Integrate the parameter “transparent_hugepage=never” within your system boot scripts (for example,. /etc/rc.local).