--- 25-akpm/mm/rmap.c | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff -puN mm/rmap.c~try_to_unmap_cluster-comment mm/rmap.c --- 25/mm/rmap.c~try_to_unmap_cluster-comment Mon May 10 15:29:02 2004 +++ 25-akpm/mm/rmap.c Mon May 10 15:29:02 2004 @@ -594,8 +594,23 @@ out: } /* - * try_to_unmap_cluster is only used on VM_NONLINEAR shared object vmas, - * in which objrmap is unable to predict where a page will be found. + * objrmap doesn't work for nonlinear VMAs because the assumption that + * offset-into-file correlates with offset-into-virtual-addresses does not hold. + * Consequently, given a particular page and its ->index, we cannot locate the + * ptes which are mapping that page without an exhaustive linear search. + * + * So what this code does is a mini "virtual scan" of each nonlinear VMA which + * maps the file to which the target page belongs. The ->vm_private_data field + * holds the current cursor into that scan. Successive searches will circulate + * around the vma's virtual address space. + * + * So as more replacement pressure is applied to the pages in a nonlinear VMA, + * more scanning pressure is placed against them as well. Eventually pages + * will become fully unmapped and are eligible for eviction. + * + * For very sparsely populated VMAs this is a little inefficient - chances are + * there there won't be many ptes located within the scan cluster. In this case + * maybe we could scan further - to the end of the pte page, perhaps. */ #define CLUSTER_SIZE (32 * PAGE_SIZE) #if CLUSTER_SIZE > PMD_SIZE _