Multilevel Page Tables for Sparse Address Spaces

Turn a large page table into a tree of allocated subranges and calculate what an absent internal entry represents.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. A flat table reserves entries for unused regions
  2. An internal entry summarizes a whole range

A flat table reserves entries for unused regions

With 32-bit virtual addresses and 4 KiB pages, there are \(2^{20}\) virtual pages. Entries of four bytes give a flat table of 4 MiB per address space. If a process uses only a few ranges, most entries are empty. Splitting the page number into two ten-bit indices lets one page of root pointers select a leaf table only when that subrange has mappings.

An internal entry summarizes a whole range

Each second-level page contains 1024 entries and covers 4 MiB of virtual addresses. An absent root entry represents that whole range without allocating its leaf table. Dense mappings reduce the memory benefit. Traversal on a translation cache miss can require several memory accesses, so TLBs matter. Address translation describes the final frame and permission check after the indices have selected an entry.[1][2]

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩
  2. Linux Kernel Documentation, Page Tables ↩