Now that I have explained the technical details of writeback, let's turn our attention to the second major aspect of the swapping subsystem — the swap policy adopted to determine which pages can be swapped out of RAM memory without seriously degrading the kernel's performance. Since page frames are freed by this and new memory is available for urgent needs, the technique is also called page reclaim.
In contrast to the previous sections concerning pages in the swap address space, this section focuses on pages in any address space. The principles of the swap policy apply for all pages without a backing store, regardless of whether their data are read from a file or are generated dynamically. The only difference is the location to which the data are written out when the kernel decides that the pages are to be removed from memory. This issue has no effect on whether a page is swapped out or not. Some pages have a permanent backing store into which they can be brought, while others must be put into the swap area (recall that Section 18.1.1 contains a more refined characterization of pages that can be swapped out).
Implementation of the swap policy algorithm is one of the more complex parts of the kernel. This is due not only to the latent question of maximum speed, but also and primarily to the multitude of special situations that must be addressed. In the examples below, I concentrate on the most frequent situations that account for the overwhelming share of the swapping subsystem's work. For the sake of brevity, I shall not discuss rare phenomena that are due largely to the interplay among the various processors on SMP systems or to random coincidences on uniprocessor systems. A general overview of the interaction between the individual components involved in swapping is much more important (and is complicated enough on its own) than the detailed minutia of every swapping operation.
Continue reading here: Overview
Was this article helpful?