NOTE: I target linux 4.6 and an x86-64 non-NUMA system.
NOTE: For the time being I am more-or-less ignoring huge page and cgroup/namespace logic, these will be considered separately.
-
Fundamentals - Overview of virtual memory concepts without referencing any actual code or making assumptions about prior knowledge.
-
Page Tables - Discussion about what page tables are, how they are used in linux, how they are manually traversed, the TLB and finally how page tables are allocated and freed.
-
Process Address Space - Discussion about virtual memory address space for processes - managing VMAs, process data structure construction/destruction, file/device-backed memory regions, page faulting, demand allocation, COW pages, copying to/from userland. _WORK IN PROGRESS
These pages list useful VM functions with a reasonably detailed description of each function, their arguments, return value and a link to the function declaration within the github mirror of the linux kernel source code:
-
General Functions - A list of general functions that don't fit under any other category.
-
Page Table Functions - Functions relating to page tables other than the copious functions relating to page table flags which rendered this page too huge.
-
Page Table Flag Functions - Page table functions relating to page table flags, separated out to avoid the page table functions page getting to huge.
-
VMA Functions - Functions relating to Virtual Memory Areas (VMAs.)
-
Physical Pages - Discussion about how physical pages are managed in linux.
-
Buddy Allocator - Discussion about the fundamental underlying physical memory allocator.
-
SLUB Allocator - Discussion about the default object allocator.
-
Out of Memory Killer - Discussion about the OOM killer.
-
Huge Pages - Discussion about huge pages, including transparent huge pages.
This repo contains my notes on the linux 4.6 VM subsystem. I don't make any claim to their quality or usefulness.
This work first originated from the notes I took from the excellent Understanding the Linux Virtual Memory Manager by Mel Gorman which, while great, targets the 2.4.22 kernel (released in 2003.) The the obvious next stage of study was to take notes for a recent kernel, which is what these notes are!
I am specifically targeting the 4.6 kernel since it was the mainline version at the time of writing and should remain a sane and stable basis for notes and hacks for the foreseeable future. I may update to newer kernel versions over time depending on whether it makes sense to do so (and if I succeed at this project of course!)
Speaking of hacks linux-vm-notes
's sister repo, linux-vm-hacks, is
where I'm putting exploratory code and patches relating to my exploration of the
VM subsystem.
These notes are licensed under Creative Commons BY-NC-SA.