next up previous contents index
Next: 10.7 Reclaiming pages from Up: 10. Page Frame Reclamation Previous: 10.5 Inode Queue   Contents   Index

10.6 Refilling inactive_list

Every time caches are being shrunk by the function shrink_caches(), pages are moved from the active_list to the inactive_list by the function refill_inactive(). It takes as a parameter the number of pages to move which is calculated as a ratio depending on nr_pages, the number of pages in active_list and the number of pages in inactive_list. The number of pages to move is calculated as


\begin{displaymath}pages = nr\_pages * \frac{nr\_active\_pages}{ 2 * (nr\_inactive\_pages + 1)} \end{displaymath}

This keeps the active_list about two thirds the size of the inactive_list and the number of pages to move is determined as a ratio based on how many pages we desire to swap out (nr_pages).

Pages are taken from the end of the active_list. If the PG_referenced flag is set, it is cleared and the page is put back at top of the active_list as it has been recently used and is still ``hot''. If the flag is cleared, it is moved to the inactive_list and the PG_referenced flag set so that it will be quickly promoted to the active_list if necessary.


next up previous contents index
Next: 10.7 Reclaiming pages from Up: 10. Page Frame Reclamation Previous: 10.5 Inode Queue   Contents   Index
Mel 2003-01-14