The Linux Memory Manager

Chapters

  1. Physical Memory - The buddy allocator, struct page*, struct folio*, the kernel functions that provide memory (e.g. alloc_pages()), nodes, zones (in brief), watermarks, migrate types, page blocks, GFP flags, migrate types, detailed analysis of physical page allocation and freeing.
  2. Virtual Memory - The why, what and how, page tables, page table flags, page table sizes, virtual memory layout, direct mapping, kernel/userland split and a detailed description of vmalloc().
  3. Process Memory - An overview of how userland memory is structured - mm_struct, Process VMAs, Copy-on-Write and more.
  4. Memory Mapping - A description of how memory mapping is performed within the kernel - mmap, brk (used by malloc()) and how mappings (via VMAs) are split/merged.
  5. Page Faults - A detailed examination of how page faults are handled and propagated within the kernel.
  6. The Reverse Mapping - A detailed look at how the kernel maps raw physical pages of userland memory back to the abstract VMA representation, in addition to how this is used to free memory.
  7. Manipulating Userland Memory - A detailed examination of both how the kernel accesses userland memory and functions which userland can use to manipulate it like madvise(), mprotect(), mlock(), mremap() and so on.
  8. The Page Cache - A detailed look into the page cache, how it interacts with the Linux virtual file system, read-ahead, read-behind and generally a very focused discussion of how the memory subsystem interacts with VFS.
  9. Writeback - A description of how writeback proceeds both originating from write() operations and memory-mapped files, how dirty data is tracked, how synchronisation functions within the kernel and how dirty throttling is applied.
  10. Reclaim and Memory Pressure - A detailed explanation of how reclaim operations, what direct and indirect reclaim are, how it interacts with demand paging, higher order page starvation, etc.
  11. Swap Memory - A detailed description of how the swap operations in the kernel and how pages are paged out and paged back in again.
  12. The Out Of Memory (OOM) Killer - A deep dive into how it works, how to tune it, the what, why and how.
  13. Practical Memory Management - A brief overview of practical memory management techniques - procfs interfaces, tuneables, decoding out of memory reports and more. Generally a practical 'how to' for sysadmins/developers.
Email me when it's released!