Skip to content
This repository has been archived by the owner on Dec 3, 2022. It is now read-only.

Latest commit

 

History

History
109 lines (80 loc) · 4.31 KB

README.md

File metadata and controls

109 lines (80 loc) · 4.31 KB

Linux VM Notes

Contents

  1. Fundamentals - Overview of virtual memory concepts without referencing any actual code or making assumptions about prior knowledge.

  2. 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.

  3. 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

  4. Transparent Huge Pages - Discussion about the kernel's transparent huge pages functionality. WORK IN PROGRESS

  5. Out of Memory Killer - Discussion about overcommit and how the OOM killer selects and kills victims.

  6. Process Autopsy - Examining the memory allocation performed by the kernel for a simple userland application. WORK IN PROGRESS

Function Cheat Sheets

  1. General Functions - A list of general functions that don't fit under any other category.

  2. Page Table Functions - Functions relating to page tables (other than the copious functions relating to page table flags which rendered this page too huge.)

  3. Page Table Flag Functions - Functions relating to page table flags, separated out to avoid the page table functions page getting too huge.

  4. VMA Functions - Functions relating to memory descriptors and Virtual Memory Areas (VMAs), which are described in the Process Address Space section.

Forthcoming

Introduction

NOTE: I target linux 4.6 and an x86-64 non-NUMA system.

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 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!)

Hacks

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.

License

These notes are licensed under Creative Commons BY-NC-SA.