Check out the new USENIX Web site. next up previous
Next: Kernel 2.4 Up: Variations of Page Replacement Previous: Kernel 2.0

Kernel 2.2

Figure 2: Selecting NRU pages in Linux Kernel 2.2.
\begin{figure}\centering \centerline{\psfig{figure=fc2.2.eps,width=2.0in,height=5.5in}} \end{figure}

In order to address the limit in Kernel 2.0, Kernel 2.2 makes each identified process continuously contribute its NRU pages until no NRU pages are available in the process. Attempting to increase CPU utilization, this strategy allows the rest of the interacting processes to build up their working sets more easily by penalizing the memory usage of one process at a time. Figure 2 shows how to select a process for page replacement in the kernel.

In this kernel, the ``swap_cnt" variable for a process can be thought as a ``shadow RSS", which becomes zero when it fails to find an NRU page from the process. After the ``swap_cnt"s of all the swappable processes become zeros, variable ``assign'' is set to 1, and the ``swap_cnt"s are re-assigned with their RSS's in the second pass going through the process list in the inner loop. This inner loop will select the swappable process with the maximal RSS. Because the ``swap_cnt" of a process remains unchanged until the NRU page search fails, a process selected for replacement will continue to be searched for NRU pages next time. Only after there is a failure in finding NRU pages, does ``swap_cnt" become 0 and the process will not be selected next time. This allows its NRU pages continuously to be replaced until a failure on finding an NRU page in the process occurs.

In addition to the changes in the selection of processes for NRU pages, there has been another major change in this kernel. It eliminates page aging and only makes use of the reference bit in the PTE (Page Table Entry) of each page. The bit is set when the page is referenced and reset when the page is examined. Thus, in this kernel the pages with reference bits of 0s are NRU pages and ready to be replaced. This implementation will produce NRU pages more quickly for a process with a high page fault rate. Both these changes in kernel 2.2 take an aggressive approach to make an examined process contribute more of its NRU pages than others, attempting to help other interacting processes to establish their working sets to fully utilize the CPU.


next up previous
Next: Kernel 2.4 Up: Variations of Page Replacement Previous: Kernel 2.0
Song Jiang 2001-09-09