Transparent Huge Pages - 57300

ZenDNN User Guide (57300)

Document ID
57300
Release Date
2025-08-18
Revision
5.1 English

Transparent Huge Pages (THPs) are a Linux kernel feature for memory management to improve performance of the application by efficiently using processor's memory-mapping hardware. THP should reduce the overhead of the Translation Lookaside Buffer. It operates mainly in two modes:

  • always: In this mode, the system kernel tries to assign huge pages to the processes running on the system. You can run the following command to set THP to always.
    echo always > /sys/kernel/mm/transparent_hugepage/enabled
  • madvise: In this mode, the kernel only assigns huge pages to the individual processes memory areas. You can run the following command to set THP to madvise.
    echo madvise > /sys/kernel/mm/transparent_hugepage/enabled

Disable THP

Log in as root to enable or disable THP settings. Use the following command to disable THP.
echo never > /sys/kernel/mm/transparent_hugepage/enabled

These are the recommended THP settings for better performance.

  • For zentorch
    • CNN models: always
    • NLP and LLM models: madvise
  • For zentf
    • CNN models: never (batch size =1), always (batch size >1)
    • NLP and Recommender models: madvise