Book description
Finally, a comprehensive guide to the Linux VM!
VM's behavior affects every Linux kernel subsystem and dramatically impacts overall performance. But until now, there was only one way to understand VM: study the poorly documented source one line at a time. Now there's an easier, faster alternative. This book describes VM in unprecedented detail, presenting both theoretical foundations and a line-by-line source code commentary. It systematically covers everything from physical memory description to out-of-memory management. Coverage includes:
Linux VM 2.4 architecture in depth-with diagrams and call graphs
Physical memory description, page tables, address spaces, and memory allocation
High memory, swapping, shared memory, and much more
Expert guidance for analyzing the code of any open source project
New Linux 2.6 kernel features in every chapter
Well organized and superbly written, Understanding the Linux Virtual Memory Manager will be indispensable to every kernel programmer and researcher.
CD-ROM INCLUDED
Complete VM Learning Lab! Contains the author's new toolkit for exploring VM, including a browsable version of kernel source, CodeViz call graph generator; and VMRegress for analyzing and benchmarking VM. Also includes all code commentary in HTML, PDF, and plain text formats.
Table of contents
- Copyright
- Bruce Perens’ Open Source Series
- About Prentice Hall Professional Technical Reference
- Preface
- 1. Introduction
- 2. Describing Physical Memory
-
3. Page Table Management
- 3.1. Describing the Page Directory
- 3.2. Describing a Page Table Entry
- 3.3. Using Page Table Entries
- 3.4. Translating and Setting Page Table Entries
- 3.5. Allocating and Freeing Page Tables
- 3.6. Kernel Page Tables
- 3.7. Mapping Addresses to a struct page
- 3.8. Translation Lookaside Buffer (TLB)
- 3.9. Level 1 CPU Cache Management
- 3.10. What’s New in 2.6
-
4. Process Address Space
- 4.1. Linear Address Space
- 4.2. Managing the Address Space
- 4.3. Process Address Space Descriptor
-
4.4. Memory Regions
- 4.4.1. Memory Region Operations
- 4.4.2. File/Device-Backed Memory Regions
- 4.4.3. Creating a Memory Region
- 4.4.4. Finding a Mapped Memory Region
- 4.4.5. Finding a Free Memory Region
- 4.4.6. Inserting a Memory Region
- 4.4.7. Merging Contiguous Regions
- 4.4.8. Remapping and Moving a Memory Region
- 4.4.9. Locking a Memory Region
- 4.4.10. Unlocking the Region
- 4.4.11. Fixing Up Regions After Locking
- 4.4.12. Deleting a Memory Region
- 4.4.13. Deleting All Memory Regions
- 4.5. Exception Handling
- 4.6. Page Faulting
- 4.7. Copying to/from Userspace
- 4.8. What’s New in 2.6
- 5. Boot Memory Allocator
- 6. Physical Page Allocation
- 7. Noncontiguous Memory Allocation
- 8. Slab Allocator
- 9. High Memory Management
- 10. Page Frame Reclamation
-
11. Swap Management
- 11.1. Describing the Swap Area
- 11.2. Mapping Page Table Entries to Swap Entries
- 11.3. Allocating a Swap Slot
- 11.4. Swap Cache
- 11.5. Reading Pages From Backing Storage
- 11.6. Writing Pages to Backing Storage
- 11.7. Reading/Writing Swap Area Blocks
- 11.8. Activating a Swap Area
- 11.9. Deactivating a Swap Area
- 11.10. What’s New in 2.6
- 12. Shared Memory Virtual Filesystem
- 13. Out of Memory Management
- 14. The Final Word
- A. Introduction
-
B. Describing Physical Memory
-
B.1. Initializing Zones
- B.1.1. Function: setup_memory() (arch/i386/kernel/setup.c)
- B.1.2. Function: zone_sizes_init() (arch/i386/mm/init.c)
- B.1.3. Function: free_area_init() (mm/page_alloc.c)
- B.1.4. Function: free_area_init_node() (mm/numa.c)
- B.1.5. Function: free_area_init_core() (mm/page_alloc.c)
- B.1.6. Function: build_zonelists() (mm/page_alloc.c)
- B.2. Page Operations
-
B.1. Initializing Zones
- C. Page Table Management
-
D. Process Address Space
- D.1. Process Memory Descriptors
-
D.2. Creating Memory Regions
- D.2.1. Creating a Memory Region
-
D.2.2. Inserting a Memory Region
- D.2.2.1. Function: __insert_vm_struct() (mm/mmap.c)
- D.2.2.2. Function: find_vma_prepare() (mm/mmap.c)
- D.2.2.3. Function: vma_link() (mm/mmap.c)
- D.2.2.4. Function: __vma_link() (mm/mmap.c)
- D.2.2.5. Function: __vma_link_list() (mm/mmap.c)
- D.2.2.6. Function: __vma_link_rb() (mm/mmap.c)
- D.2.2.7. Function: __vma_link_file() (mm/mmap.c)
- D.2.3. Merging Contiguous Regions
-
D.2.4. Remapping and Moving a Memory Region
- D.2.4.1. Function: sys_mremap() (mm/mremap.c)
- D.2.4.2. Function: do_mremap() (mm/mremap.c)
- D.2.4.3. Function: move_vma() (mm/mremap.c)
- D.2.4.4. Function: make_pages_present() (mm/memory.c)
- D.2.4.5. Function: get_user_pages() (mm/memory.c)
- D.2.4.6. Function: move_page_tables() (mm/mremap.c)
- D.2.4.7. Function: move_one_page() (mm/mremap.c)
- D.2.4.8. Function: get_one_pte() (mm/mremap.c)
- D.2.4.9. Function: alloc_one_pte() (mm/mremap.c)
- D.2.4.10. Function: copy_one_pte() (mm/mremap.c)
- D.2.5. Deleting a Memory Region
- D.2.6. Deleting All Memory Regions
- D.3. Searching Memory Regions
- D.4. Locking and Unlocking Memory Regions
- D.5. Page Faulting
-
D.6. Page-Related Disk I/O
- D.6.1. Generic File Reading
- D.6.2. Generic File mmap()
-
D.6.3. Generic File Truncation
- D.6.3.1. Function: vmtruncate() (mm/memory.c)
- D.6.3.2. Function: vmtruncate_list() (mm/memory.c)
- D.6.3.3. Function: zap_page_range() (mm/memory.c)
- D.6.3.4. Function: zap_pmd_range() (mm/memory.c)
- D.6.3.5. Function: zap_pte_range() (mm/memory.c)
- D.6.3.6. Function: truncate_inode_pages() (mm/filemap.c)
- D.6.3.7. Function: truncate_list_pages() (mm/filemap.c)
- D.6.3.8. Function: truncate_complete_page() (mm/filemap.c)
- D.6.3.9. Function: do_flushpage() (mm/filemap.c)
- D.6.3.10. Function: truncate_partial_page() (mm/filemap.c)
- D.6.4. Reading Pages for the Page Cache
- D.6.5. File Readahead for nopage()
- D.6.6. Swap-Related Read-Ahead
- E. Boot Memory Allocator
- F. Physical Page Allocation
-
G. Noncontiguous Memory Allocation
-
G.1. Allocating a Noncontiguous Area
- G.1.1. Function: vmalloc() (include/linux/vmalloc.h)
- G.1.2. Function: __vmalloc() (mm/vmalloc.c)
- G.1.3. Function: get_vm_area() (mm/vmalloc.c)
- G.1.4. Function: vmalloc_area_pages() (mm/vmalloc.c)
- G.1.5. Function: __vmalloc_area_pages() (mm/vmalloc.c)
- G.1.6. Function: alloc_area_pmd() (mm/vmalloc.c)
- G.1.7. Function: alloc_area_pte() (mm/vmalloc.c)
- G.1.8. Function: vmap() (mm/vmalloc.c)
- G.2. Freeing a Noncontiguous Area
-
G.1. Allocating a Noncontiguous Area
-
H. Slab Allocator
- H.1. Cache Manipulation
- H.2. Slabs
-
H.3. Objects
- H.3.1. Initializing Objects in a Slab
-
H.3.2. Object Allocation
- H.3.2.1. Function: kmem_cache_alloc() (mm/slab.c)
- H.3.2.2. Function: __kmem_cache_alloc (UP Case)() (mm/slab.c)
- H.3.2.3. Function: __kmem_cache_alloc (SMP Case)() (mm/slab.c)
- H.3.2.4. Function: kmem_cache_alloc_head() (mm/slab.c)
- H.3.2.5. Function: kmem_cache_alloc_one() (mm/slab.c)
- H.3.2.6. Function: kmem_cache_alloc_one_tail() (mm/slab.c)
- H.3.2.7. Function: kmem_cache_alloc_batch() (mm/slab.c)
-
H.3.3. Object Freeing
- H.3.3.1. Function: kmem_cache_free() (mm/slab.c)
- H.3.3.2. Function: __kmem_cache_free (UP Case)() (mm/slab.c)
- H.3.3.3. Function: __kmem_cache_free (SMP Case)() (mm/slab.c)
- H.3.3.4. Function: kmem_cache_free_one() (mm/slab.c)
- H.3.3.5. Function: free_block() (mm/slab.c)
- H.3.3.6. Function: __free_block() (mm/slab.c)
- H.4. Sizes Cache
- H.5. Per-CPU Object Cache
- H.6. Slab Allocator Initialization
- H.7. Interfacing with the Buddy Allocator
-
I. High Memory Management
-
I.1. Mapping High Memory Pages
- I.1.1. Function: kmap() (include/asm-i386/highmem.c)
- I.1.2. Function: kmap_nonblock() (include/asm-i386/highmem.c)
- I.1.3. Function: __kmap() (include/asm-i386/highmem.h)
- I.1.4. Function: kmap_high() (mm/highmem.c)
- I.1.5. Function: map_new_virtual() (mm/highmem.c)
- I.1.6. Function: flush_all_zero_pkmaps() (mm/highmem.c)
- I.2. Mapping High Memory Pages Atomically
- I.3. Unmapping Pages
- I.4. Unmapping High Memory Pages Atomically
- I.5. Bounce Buffers
- I.6. Emergency Pools
-
I.1. Mapping High Memory Pages
-
J. Page Frame Reclamation
-
J.1. Page Cache Operations
- J.1.1. Adding Pages to the Page Cache
- J.1.2. Deleting Pages From the Page Cache
- J.1.3. Acquiring/Releasing Page Cache Pages
-
J.1.4. Searching the Page Cache
- J.1.4.1. Function: find_get_page() (include/linux/pagemap.h)
- J.1.4.2. Function: __find_get_page() (mm/filemap.c)
- J.1.4.3. Function: __find_page_nolock() (mm/filemap.c)
- J.1.4.4. Function: find_lock_page() (include/linux/pagemap.h)
- J.1.4.5. Function: __find_lock_page() (mm/filemap.c)
- J.1.4.6. Function: __find_lock_page_helper() (mm/filemap.c)
- J.2. LRU List Operations
- J.3. Refilling inactive_list
- J.4. Reclaiming Pages From the LRU Lists
- J.5. Shrinking All Caches
- J.6. Swapping Out Process Pages
- J.7. Page Swap Daemon
-
J.1. Page Cache Operations
-
K. Swap Management
- K.1. Scanning for Free Entries
- K.2. Swap Cache
- K.3. Swap Area I/O
- K.4. Activating a Swap Area
-
K.5. Deactivating a Swap Area
- K.5.1. Function: sys_swapoff() (mm/swapfile.c)
- K.5.2. Function: try_to_unuse() (mm/swapfile.c)
- K.5.3. Function: unuse_process() (mm/swapfile.c)
- K.5.4. Function: unuse_vma() (mm/swapfile.c)
- K.5.5. Function: unuse_pgd() (mm/swapfile.c)
- K.5.6. Function: unuse_pmd() (mm/swapfile.c)
- K.5.7. Function: unuse_pte() (mm/swapfile.c)
-
L. Shared Memory Virtual Filesystem
- L.1. Initializing shmfs
- L.2. Creating Files in tmpfs
- L.3. File Operations in tmpfs
- L.4. Inode Operations in tmpfs
- L.5. Page Faulting Within a Virtual File
- L.6. Swap Space Interaction
- L.7. Setting Up Shared Regions
- L.8. System V IPC
- M. Out of Memory Management
- References
- About the Author
- About the CD-ROM
Product information
- Title: Understanding the Linux® Virtual Memory Manager
- Author(s):
- Release date: April 2004
- Publisher(s): Pearson
- ISBN: 9780131453487
You might also like
book
Designing Secure IoT Devices with the Arm Platform Security Architecture and Cortex-M33
Designing Secure IoT devices with the Arm Platform Security Architecture and Cortex-M33 explains how to design …
audiobook
Transformed
Help transform your business and innovate like the world's top tech companies! Transformed: Moving to the …
book
Reverse Engineering Code with IDA Pro
If you want to master the art and science of reverse engineering code with IDA Pro …
book
Military Gadgets: How Advanced Technology Is Transforming Today’s Battlefield…and Tomorrow’s
Coalition soldiers in the war in Iraq had access to the most extraordinary array of high-tech …