From: Hamid R. Jahanjou
Implements the idea of swap-out page clustering from *BSD for
Linux. Each time a candidate page is to be swapped out,
virtually-nearby pages are scanned to find eligible pages to be
swapped out too as a cluster. This technique increases the likelihood of
bringing in related data on a page fault and decreases swap space
fragmentation in the long run. Currently, Linux searches only
physically-nearby pages which is not optimal since, over time, physically-
adjacent pages may become unrelated.
The code can be statically tuned. No benchmarks. I'm not sure whether
the added complexity is acceptable.
Signed-off-by: Hamid R. Jahanjou <hamid.jahanjou@xxxxxxxxx>
[snip a lot of code here]
+
+ for(vm_address = cursor_vma->vm_start; + vm_address < cursor_vma->vm_end && ci->nr_collected < ci->cluster_size; + vm_address += PAGE_SIZE)
+ {
+ cursor_page = virt_to_page(vm_address);
+ if (!page_allowed_in_cluster(cursor_page, ci))
+ continue;