[mm]kernel v7.2 · mm/

Memory Management

Virtual memory, page allocator, slab/slub, NUMA topology, huge pages, and OOM killer — the mm subsystem dissected.

Subsystem Overview

The Linux memory management subsystem is responsible for the entire lifecycle of physical and virtual memory: allocation, mapping, reclaim, and release. It abstracts hardware MMU differences behind a unified virtual address space model, implements demand paging, and enforces memory isolation between processes.

At its core, mm/ manages a hierarchy of allocators — from the raw page allocator (buddy system) at the bottom, through the slab/slub object caches in the middle, up to the vmalloc and kmalloc interfaces used by the rest of the kernel. Each layer trades granularity for speed.

In Linux 7.2, the mm subsystem introduced per-node compaction throttling, improved folio-based page cache operations, and extended the memory-tiering framework for CXL-attached memory.

Diagrams

// interactive · hover to explore

Virtual Address Space (x86-64)0xFFFF...User Stack (grows ↓)0x7fff...mmap / shared libs~0x7f00...Heap (grows ↑)brkBSS segmentData segmentText (code)0x0040...PAGE_OFFSETKernel direct mapffff8880...vmalloc / ioremapffffc900...Kernel text + dataffffffff...0x0000...

Virtual Memory Layout

Full x86-64 address space: user regions, kernel direct map, vmalloc, and text.

Buddy Allocator — Free Lists by Orderorder-0 (4KB)head2^02^02^02^02^02^02^02^0order-1 (8KB)head2^12^12^12^1order-2 (16KB)head2^22^2order-3 (32KB)head2^3Allocation splits higher orders · Freeing coalesces buddies

Buddy Allocator Free Lists

Per-order free lists showing how 2^N page blocks are tracked and coalesced.

Page Fault Handler Flowvalid VMAno VMACPU: #PF exceptiondo_page_fault()find_vma()handle_mm_fault()COW / swap-in / zeroSIGSEGV

Page Fault Handler Flow

From CPU #PF exception through do_page_fault() to COW, swap-in, or SIGSEGV.

Key Concepts

struct page

The fundamental unit of physical memory tracking. Each physical page frame has a corresponding struct page in the mem_map array. In 7.2, folios (compound pages) are the preferred abstraction for multi-page allocations.

VMA (vm_area_struct)

Describes a contiguous virtual address range within a process address space. VMAs are stored in an interval tree (maple tree in 7.2) for O(log n) lookup. Each VMA carries vm_flags, a backing vm_file, and vm_ops function pointers.

Page Tables

Multi-level hardware page tables (PGD → P4D → PUD → PMD → PTE on x86-64) map virtual to physical addresses. The kernel maintains per-process page tables and a shared kernel page table region above PAGE_OFFSET.

Buddy Allocator

The physical page allocator. Maintains free lists of 2^order contiguous pages (order 0–10). Allocation splits higher-order blocks; freeing coalesces buddies. Fragmentation is managed by compaction and memory defragmentation.

SLAB/SLUB/SLOB

Object-level allocators built on top of the buddy system. SLUB (the default since 2.6.23) groups same-size objects into slabs, minimising internal fragmentation and improving cache locality via per-CPU partial lists.

OOM Killer

When the system cannot satisfy an allocation after reclaim, the OOM killer selects a victim process using an oom_score heuristic (RSS + swap + child RSS, adjusted by oom_score_adj) and sends SIGKILL.

Source References

// linux/mm/ · annotated entry points

mm/memory.cCore virtual memory operations: do_page_fault(), handle_mm_fault(), copy_page_range()elixir ↗
mm/page_alloc.cBuddy allocator: __alloc_pages(), free_pages(), zone watermarks, compactionelixir ↗
mm/slub.cSLUB allocator: kmem_cache_alloc(), slab_alloc_node(), per-CPU fast pathelixir ↗
mm/vmscan.cPage reclaim: shrink_lruvec(), kswapd, direct reclaim, swap-out logicelixir ↗
mm/oom_kill.cOOM killer: out_of_memory(), oom_kill_process(), oom_score calculationelixir ↗
include/linux/mm_types.hCore data structures: struct page, struct vm_area_struct, struct mm_structelixir ↗

Linux 7.2 Changes

// recent mm/ commits

2026-08-14Introduce per-node memory compaction throttling to reduce latency spikes under pressure
2026-07-29folio: convert page cache reads to folio-native paths, removing legacy page wrappers
2026-07-11memory-tiering: add CXL slow-tier promotion/demotion via access-frequency tracking