RFC: malloc automatic THP opt-in breaks madvise contract for container hosts

Project / Subsystem

glibc / malloc

Date

2026-04-17

Proposer

Sun, Yutong <[email protected]>

Source type

public_inbox

Consensus

Proposed

Sentiment

4/10

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.

All attributes

project
glibc
subsystem
malloc
patch_id
discussion_id
[email protected]
source_type
public_inbox
title
RFC: malloc automatic THP opt-in breaks madvise contract for container hosts
headline
Automatic THP in malloc breaks madvise for container hosts
tldr
Glibc's automatic THP opt-in via madvise hurts container hosts by allocating huge pages to small management processes instead of actual workloads.
stakes
Unexpected THP usage can degrade performance in containerized environments, wasting memory on shims instead of benefiting the intended applications.
proposer
Sun, Yutong <[email protected]>
consensus
Proposed
outcome
proposed
sentiment_score
4
sentiment_rationale
The RFC identifies a performance regression in a specific use case (container hosts), which can lead to contention.
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.
series_id
series_role
standalone
series_parts
[]
tags
  • malloc
  • THP
  • containers
  • performance
  • madvise
bugzilla_url
date
2026-04-17T00:00:00.000Z

RFC: malloc automatic THP opt-in breaks madvise contract for container hosts

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.