Page Table Memory Consumption
Page tables typically consume under 1 percent of memory, but multi-process shared memory and allocator behaviors can cause massive, hidden memory bloat.
read it It provides a detailed breakdown of hidden page table memory overheads in modern Linux workloads, complete with historical kernel examples and production database failure modes.
summary
While page tables normally use a tiny fraction of RAM, workloads involving many processes mapping shared memory or allocators using madvise can trigger severe page table inflation. The article tracks kernel mailing list discussions and production incidents in databases like Postgres and ClickHouse where page tables consume gigabytes of memory. It also highlights the complex trade-offs of using huge pages and the growing page table bottlenecks on NUMA architectures.
key points
- When multiple processes map the same shared memory, each process requires its own page table entries, scaling memory consumption up to N/512 of the mapped data.
- Memory allocators using madvise(MADV_DONTNEED) keep empty page tables allocated instead of freeing them, leading to significant memory waste.
- Databases with high connection counts face severe page table growth that can be mitigated by huge pages, though this risks memory fragmentation and allocation stalls.
who should read it
Systems engineers, database administrators, and kernel developers troubleshooting high-scale memory overhead and OOM issues.
discussion positive
consensus
Commenters discuss related edge cases, such as how security-driven random virtual address allocation and Windows zombie processes can also cause severe page table bloat.
pushback
One commenter notes that alternative hashed page table architectures would likely face the exact same scaling, process-isolation, and NUMA penalties.
While this article correctly points out issues with tree based page tables, it fails to describe how the other option (a PowerPC style hashed page table) being considered by Torvalds, et al. is any better. And a cursory glance doesn't appear to support them being better under the cases described; each issue seems like it'd be the same or worse under hashed page tables.
For one, the hash on PowerPC is over the virtual address and a VSID (virtual segment ID) which functionally gets used as an address space ID[0]. That means that hashed page tables also have separate entries for each process …
It provides a technical critique explaining why alternative hashed page table designs do not solve the described memory consumption issues.
Generated by an LLM from the article and thread. Check the sources before relying on it.