Leveraging Highly-Volatile Pages to Improve Memory Compaction Efficiency in Linux

image

Context

Paging was long believed to have eliminated external fragmentation in physical memory management. In particular, this assumption has led page-frame allocators to largely ignore fragmentation, scattering allocated pages across the physical address space. However, as technology has evolved, physical memory fragmentation has resurfaced as a significant concern.

Modern systems can utilize large contiguous regions of free physical memory — for example, to reduce TLB pressure through the allocation of huge pages or to improve energy efficiency via DRAM power-management techniques. Consequently, contemporary operating systems must provide efficient and robust mechanisms for rearranging memory contents to reclaim free blocks of the required size.

Focusing on the power-management implications of memory fragmentation, we have developed a memory compaction mechanism optimized for coarse granularities. The mechanism partitions the physical address space into slices, each representing a power-management domain, and periodically reorganizes memory contents to minimize the amount of active slices. Each slice is assigned a score reflecting the estimated effort to offline it. By prioritizing the slices with the lowest score, the mechanism achieves near-optimal compaction with minimal effort.

Problem

Moving an allocated page from one frame to another is an inherently costly operation. It begins with allocating a destination page frame. In the context of compaction this involves a sophisticated search for a suitable target location. A significant portion of the migration time is consumed by copying the page's contents. Additionally, the operating system's memory-management bookkeeping structures must be updated. Finally, the virtual address space mappings of all processes referencing the page must be adjusted, a step that can account for nearly half of the total migration time.

Goal

Reclaiming a slice is a two-step process. First, the slice is isolated from the page-frame allocator to prevent any new allocations while it is being reclaimed. Next, the slice is scanned for allocated pages, which are then migrated to suitable destination page frames.

Studies report that the overwhelming majority of processes live for less than 30 seconds (Power-aware operating systems for interactive systems). This suggests that, within a reasonable time frame, a significant number of page frames may become free naturally, potentially reducing the need to migrate them. Given the relatively slow timescale of the power-management goal, investigate whether introducing a deliberate delay into the two-step compaction process could improve its overall efficiency.


References

DIMES Workshop Best Paper Award
The New Costs of Physical Memory Fragmentation
Alexander Halbuer, Illia Ostapyshyn, Lukas Steiner, Lars Wrenger, Matthias Jung, Christian Dietrich, Daniel LohmannProceedings of the 2nd Workshop on Disruptive Memory Systems (SOSP-DIMES '24)Association for Computing Machinery2024Best Paper Award.
PDF Details 10.1145/3698783.3699378 [BibTex]
Power-aware operating systems for interactive systems
Yung-Hsiang Lu, L. Benini, G. De Micheli.
10.1109/92.994989 [BibTex]

Enhancing Energy Efficiency with Advanced DRAM Management in Linux

Modern computer systems face a significant challenge in managing physical memory efficiently, especially in the context of energy consumption. Specifically, the DRAM (Dynamic Random-Access Memory) components in these systems consume a considerable amount of energy due to their constant refresh requirements. [PDF]

 
Typ
Masterarbeit

 
Status
abgeschlossen

 
Supervisors
Alexander Halbuer
Christian Dietrich
Daniel Lohmann

 
Projects
ParPerOS
DRAMaOS

 
Bearbeiter
Illia Ostapyshyn (abgegeben: 01. Nov 2024)

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

We want to give the kernel page frame allocator more information allowing it group allocations intelligently and avoid fragmentation.

 
Typ
Bachelorarbeit

 
Status
abgeschlossen

 
Supervisors
Lars Wrenger
Daniel Lohmann

 
Project
ParPerOS