Configuring Transparent HugePages
Explains how to review and adjust Transparent HugePages parameters, including status checks, mode changes, and defragment settings.
The Transparent HugePages (THP) feature is enabled by default in Oracle Linux. However, you might still need to access and configure THP according to the system's needs.
Parameters Used to Configure Transparent HugePages
The following table describes selected parameter settings that can be used when configuring Transparent HugePages (THP).
| Parameter | File Location | Value Options |
|---|---|---|
enabled
|
/sys/kernel/mm/transparent_hugepage/enabled
|
Sets THP and its mode, which is one of the following:
|
defrag
|
/sys/kernel/mm/transparent_hugepage/defrag
|
Determines how aggressively an application can reclaim pages and
defrag memory when THP is unavailable. The following list
explains the available options:
|
Retrieving the Current Status of Transparent HugePages
Shows how to check the Transparent HugePages mode by reading the sysfs status file.
This procedure shows how to see the current status of THP in the sysfs
virtual file system.
For more information about using the sysfs virtual file system, see
Managing Kernels and System Boot on Oracle Linux.
To see the current setting of THP you can read the
/sys/kernel/mm/transparent_hugepage/enabled parameter.
sysfs.
cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
The value inside the square brackets represents the current setting.
Changing the Current Status of Transparent HugePages
Explains how to switch Transparent HugePages between available modes with sysfs updates.
This procedure shows how to change the current status of THP by setting a value in the
sysfs virtual file system.
For more information about using the sysfs virtual file system, see
Managing Kernels and System Boot on Oracle Linux.
To change the current status of THP, you need to write the preferred settings to
/sys/kernel/mm/transparent_hugepage/enabled. The following example
shows you how to set the status to always.
Virtual file systems such as sysfs provide a file system interface to
items that aren't necessarily stored as files on disk. The sysfs files
therefore don't always interact with file commands in the same way that regular physical
files on disk would. In the example procedure, the echo command used
doesn't overwrite /sys/kernel/mm/transparent_hugepage/enabled, as it
would if used with a regular file, but instead changes the selected option.
Changing the defrag Setting of Transparent HugePages
Describes how to tune the Transparent HugePages defrag policy to balance performance and availability.
This procedure shows how to change the defragmentation setting of THP by setting a
value in the sysfs virtual file system.
For more information about using the sysfs virtual file system, see
Managing Kernels and System Boot on Oracle Linux.
To change the THP defrag setting you need to write the new setting to
/sys/kernel/mm/transparent_hugepage/defrag.
The best defrag setting varies from system to system. Reclaiming
pages and memory compaction can increase the number of THP pages available.
However, the process also uses CPU time. Therefore, you need to find the correct
balance for a specific system.
The following example shows you how to set the defrag setting to
madvise.