Mmvmscanc

while (nr_active || nr_inactive) { if (nr_active) {

(unsigned long)sc->swap_cluster_max); nr_active -= sc->nr_to_scan;

shrink_active_list(nr_to_scan, zone, sc, priority);

(unsigned long)sc->swap_cluster_max); nr_inactive -= sc->nr_to_scan;

nr_reclaimed += shrink_inactive_list(nr_to_scan, zone, sc);

return nr_reclaimed;

The loop is not executed unless the threshold is exceeded for nr_active or nr_inactive. In the loop, the kernel makes a distinction as to whether inactive, pages, active pages, or both are to be scanned:

□ If active pages are to be scanned, the kernel uses shrink_active_list to move pages from the active to the inactive LRU list. Naturally, the least used of the active pages are moved.

□ Inactive pages can be removed directly from the caches by means of shrink_active_list. The function tries to take the required number of pages to be reclaimed from the inactive list. The number of pages for which this actually succeeded is returned.

The loop is terminated when sufficient pages of both categories have been scanned and the local counters have reached 0.

Shrinking the LRU lists in shrink_active_list and shrink_inactive_list requires a means to select pages from these lists, so an auxiliary function to perform this job must be introduced before we can discuss them.

Continue reading here: Isolating LRU Pages and Lumpy Reclaim

Was this article helpful?

0 0