Re: [patch 3/3 take2] smaps: add clear_refs file to clear reference

Andrew Morton
2007-02-07T06:33:50Z

On Tue, 6 Feb 2007 22:15:59 -0800 (PST) David Rientjes <rientjes@google.com> wrote:

> +static void clear_refs_pte_func(struct pte_walker *walker, pte_t *pte,
> + unsigned long addr)
> +{
> + struct page *page;
> + pte_t ptent;
> +
> + ptent = *pte;
> + if (!pte_present(ptent))
> + return;
> +
> + page = vm_normal_page(walker->vma, addr, ptent);
> + if (!page)
> + return;
> + pte_mkold(ptent);

That only changed the local variable, and not the pagetable entry.

> + ClearPageReferenced(page);
> +}

Please, do some good runtime testing. Write a script to monitor the
overall working set, run it for some sample workloads (your X server or
mozilla would be good choices). Share the results with us so we can marvel
at the efficiency of modern applications. Include these examples in the
changelog.

Also, we will need to do tlb writeback and invalidation prior to this
operation. Documentation/cachetlb.txt has details.