2

I need to disable THP (Transparent Huge Pages). Many tutorials on the web advise to set never (0 for last one) value for below options.

  • /sys/kernel/mm/transparent_hugepage/enabled
  • /sys/kernel/mm/transparent_hugepage/defrag
  • /sys/kernel/mm/transparent_hugepage/khugepaged/defrag

My question is - since THP is going to be disabled, is it important to disable defrag options as well? Can I consider last 2 options non important in this case? I couldn't find any docs with confirmation.

waste
  • 151
  • 8

1 Answers1

3

Kernel documentation proved to be helpful. This page exactly: https://www.kernel.org/doc/Documentation/vm/transhuge.txt

Transparent Hugepage Support for anonymous memory can be entirely disabled (mostly for debugging purposes) or only enabled inside MADV_HUGEPAGE regions (to avoid the risk of consuming more memory resources) or enabled system wide. This can be achieved with one of:

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

echo madvise > /kernel/mm/transparent_hugepage/enabled

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

And few paragraphs below.

khugepaged will be automatically started when transparent_hugepage/enabled is set to "always" or "madvise, and it'll be automatically shutdown if it's set to "never".

There is no concrete information about impact on /sys/kernel/mm/transparent_hugepage/defrag option. Yet, since they said that setting option /sys/kernel/mm/transparent_hugepage/enabled to never will entirely disable THP, I can only assume that - indeed - it's safe to ignore other options, as they won't have any impact on disabled feature.

waste
  • 151
  • 8