Re: [patch 2/3] smaps: add pages referenced count to smaps

From: Andrew Morton
Date: Wed Feb 07 2007 - 00:44:48 EST


On Tue, 6 Feb 2007 21:27:03 -0800 (PST) David Rientjes <rientjes@xxxxxxxxxx> wrote:

> @@ -190,18 +191,20 @@ static int show_map_internal(struct seq_file *m, void *v, struct mem_size_stats
>
> if (mss)
> seq_printf(m,
> - "Size: %8lu kB\n"
> - "Rss: %8lu kB\n"
> - "Shared_Clean: %8lu kB\n"
> - "Shared_Dirty: %8lu kB\n"
> - "Private_Clean: %8lu kB\n"
> - "Private_Dirty: %8lu kB\n",
> + "Size: %8lu kB\n"
> + "Rss: %8lu kB\n"
> + "Shared_Clean: %8lu kB\n"
> + "Shared_Dirty: %8lu kB\n"
> + "Private_Clean: %8lu kB\n"
> + "Private_Dirty: %8lu kB\n"
> + "Pgs_Referenced: %8li\n",

I guess we might as well make this %8lu kB as well?

> (vma->vm_end - vma->vm_start) >> 10,
> mss->resident >> 10,
> mss->shared_clean >> 10,
> mss->shared_dirty >> 10,
> mss->private_clean >> 10,
> - mss->private_dirty >> 10);
> + mss->private_dirty >> 10,
> + mss->referenced);
>
> ...
>
> + /* Accumulate the number of pages that have been accessed. */
> + if (PageReferenced(page))
> + mss->referenced++;

This is testing the software-referenced bit. We want to be counting the
pte-referenced bits (pte_young).

Hence poking clear_refs should run pte_mkold().

Perhaps we should also be running ClearPageReferenced and counting pages
which are pte_young()||PageReferenced.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/