Spatially Grouping Allocations based on their Context to avoid Memory Fragmentation in Linux

Even though, for a short time, paging solved the external fragmentation for the physical memory management, this problem resurfaced since the more widespread use of huge pages. The page allocator originally only had to manage a single block size, usually 4 KiB page frames. Huge pages add another granularity, 2 MiB, which can also be mapped to userspace applications that have high memory demands. There are even efforts to manage larger blocks, e.g., giant paging for even more memory intensive applications and virtual machines, or reducing power consumption by disabling parts of the DRAM. This means external fragmentation is back.

The Linux page frame allocator, even though containing a few optimizations for huge pages, has the tendency to fragment over time. Even our improved LLFree page frame allocator, which has a superior fragmentation avoidance, still has room for improvements. Currently, the allocator spatially groups allocations that happen at the same time. The assumption is that these allocations have similar lifetimes and are also freed at the same time, clearing a large continuous chunk. This (somewhat limited) lifetime heuristic might be improved significantly by incorporating the context of an allocation. Allocations for the same files, VMAs, processes or process groups are expected to have similar lifetimes. Grouping them might be far more accurate. The topic of this thesis is to evaluate whether, and if so, how much, this contextual information can improve the long-time fragmentation behavior.

Topics: Linux, C, Allocator

image


USENIX Conference A Distinguished Artifact Award
LLFree: Scalable and Optionally-Persistent Page-Frame Allocation
Lars Wrenger, Florian Rommel, Alexander Halbuer, Christian Dietrich, Daniel Lohmann2023 USENIX Annual Technical Conference (USENIX '23)USENIX Association2023Distinguished Artifact Award.
PDF Details Slides [BibTex]
EuroSys Conference A
HyperAlloc: Efficient VM Memory De/Inflation via Hypervisor-Shared Page-Frame Allocators
Lars Wrenger, Kenny Albes, Marco Wurps, Christian Dietrich, Daniel LohmannProceedings of the Twentieth European Conference on Computer SystemsACM2025.
PDF Details 10.1145/3689031.3717484 [BibTex]