The swap cache is implemented by the page cache data structures and procedures, which are described in Section 14.1. Recall that the core of the page cache is a hash table that allows the algorithm to quickly derive the address of a page descriptor from the address of an address_space object identifying the owner of the page as well as from an offset value.
Pages in the swap cache are stored like any other page in the page cache, with the following special treatment:
• The mapping field of the page descriptor points to an address_space object stored in the swapper space variable.
• The index field stores the swapped-out page identifier associated with the page.
Moreover, when the page is put in the swap cache, both the count field of the page descriptor and the page slot usage counters are incremented, since the swap cache uses both the page frame and the page slot.
Was this article helpful?