Performance Tuning for Linux Servers [Electronic resources]

Sandra K. Johnson

نسخه متنی -صفحه : 227/ 96
نمايش فراداده

The Linux Page Tables

The Linux system maintains a page table for each process in physical memory and accesses the actual page tables via the identity mapped kernel segment. Page tables in Linux cannot be paged out to the swap space. This implies that a process that allocates a large range of address space could potentially saturate the memory subsystem, because the page table itself would use up all the available memory. On a similar note, because hundreds of processes are active simultaneously on a system, the combined size of all the page tables could potentially use all available memory. The large memory subsystems available on contemporary systems render this scenario unusual, but it still reflects a capacity planning issue that should be addressed. Keeping the page tables in physical memory simplifies the kernel design, and there is no need to deal with nested page faults. The per-process page table layout is based on a multilayer tree consisting of three levels. The first layer consists of the global directory (pgd), the second layer consists of the middle directory (pmd), and the third layer consists of the page table entry (pte). Normally, each directory node occupies one page frame and contains a fixed number of entries. Entries in the pgd and pmd directories are either not present or they point to a directory in the next layer of the tree. The pte entries depict the leaf nodes of the tree, and they contain the actual page table entries. Because the page table layout in Linux resembles a multilayer tree, the space requirements are proportional to the actual virtual address space in use. Therefore, the space requirements are not the maximum size of the virtual address space. Further, because Linux manages memory as a set of page frames, the fixed node size-based approach does not require the large and physically contiguous region of memory that the linear page table-based implementation requires.VM Tunables" for more information on memory zones.)

Figure 9-3. Address resolution process.

[View full size image]

The next section introduces, from a performance perspective, some of the new features in Linux 2.6. The VM system impacts every other subcomponent in the system; this discussion extends into the CPU and the I/O subsystem components covered in a separate chapter.