---

Linux: Memory Compaction

“Mel Gorman posted the seventh version of his Memory Compaction
patches asking, “are there any further obstacles to merging?” The
patches, first posted in May of 2007, provide a mechanism for
moving GFP_MOVABLE pages into a smaller number of pageblocks,
reducing externally fragmented memory. Mel explains that
‘compaction’ is another method of defragmenting memory, “for
example, lumpy reclaim is a form of defragmentation as was slub
‘defragmentation’ (really a form of targeted reclaim). Hence, this
is called ‘compaction’ to distinguish it from other forms of
defragmentation.”

“The core compaction patch explains that memory is compacted in
a zone by relocating movable pages towards the end of the zone:

“”A single compaction run involves a migration scanner and a
free scanner. Both scanners operate on pageblock-sized areas in the
zone. The migration scanner starts at the bottom of the zone and
searches for all movable pages within each area, isolating them
onto a private list called migratelist. The free scanner starts at
the top of the zone and searches for suitable areas and consumes
the free pages within making them available for the migration
scanner. The pages isolated for migration are then migrated to the
newly isolated free pages.”

Complete
Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis