Allow JemallocHugePageAllocator to Grow
Summary: This diff switches the JemallocHugePageAllocator to permit initially reserving a (very) large contiguous region of virtual address space, which can then be progressively backed by huge pages on demand. This is intended to increase the flexibility of the allocator. In particular, this should enable automatic initialization of the JHA without having to carefully and correctly size the arena. (Assumption: `mmap()`'ing a big chunk of address is cheap, right? Although even if it is this is probably something we should only do for long-lived processes. Identifying "long-lived processes" and triggering initialization in them is itself an open topic to be addressed in a subsequent diff.) The concern here is that this potentially moves `madvise(..., MADV_HUGEPAGE)` calls later into the process lifetime, when memory pressure/fragmentation may be greater. This might induce stalls in the process? This can be mitigated using the existing pattern of explicitly calling `::init()` in your processes' `main()`. This will commit the requested pages. Context: I intend to use this allocator to back allocations in the Zstd Compression Context Singletons. (`folly/compression/CompressionContextPoolSingletons.cpp`) Feedback on the approach taken here is greatly appreciated! Reviewed By: davidtgoldblatt Differential Revision: D29502147 fbshipit-source-id: 814e1ba3544cf5b5cfb67a08abd18f940255362f
Showing
Please register or sign in to comment