MONDAY, APRIL 20, 2026 GLIBC DIGEST · OPEN-SOURCE SYSTEMS DAILY VOL. 1 · NO. 110
Late Edition · APRIL 20, 2026 · VOL. 1 · NO. 110
The glibc Digest
— A Daily Record of the GNU C Library —
malloc Proposed

Automatic THP in malloc breaks madvise for container hosts

Glibc's automatic THP opt-in via madvise hurts container hosts by allocating huge pages to small management processes instead of actual workloads.

Yutong Sun raises concerns about glibc’s automatic Transparent Huge Pages (THP) opt-in behavior via madvise(MADV_HUGEPAGE) for heap allocations. This breaks the intended semantics of madvise mode where applications explicitly opt-in. On container hosts, this leads to small management processes (container shims) receiving huge page allocations, while actual container workloads do not, wasting memory. The author proposes either reverting the change or making THP usage opt-in.

Technical Tradeoffs

  • Automatic THP allocation can be beneficial for some workloads but detrimental in container environments.
  • Using GLIBC_TUNABLES is not a stable ABI.
  • Disabling THP system-wide penalizes workloads that benefit from it.
Filed Under: mallocTHPcontainersperformancemadvise