Re: zoned VM stats: Add NR_ANON

KAMEZAWA Hiroyuki
2006-06-10T04:32:07Z

On Fri, 9 Jun 2006 11:54:07 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> Note that this will change the meaning of the number of mapped pages
> reported in /proc/vmstat /proc/meminfo and in the per node statistics.
> This may affect user space tools that monitor these counters!
>
> However, NR_MAPPED then works like NR_DIRTY. It is only valid for
> pagecache pages.

> Index: linux-2.6.17-rc6-mm1/mm/rmap.c
> ===================================================================
> --- linux-2.6.17-rc6-mm1.orig/mm/rmap.c 2006-06-09 10:30:51.768993888 -0700
> +++ linux-2.6.17-rc6-mm1/mm/rmap.c 2006-06-09 11:26:59.389471258 -0700
> @@ -455,7 +455,7 @@ static void __page_set_anon_rmap(struct
> * nr_mapped state can be updated without turning off
> * interrupts because it is not modified via interrupt.
> */
> - __inc_zone_page_state(page, NR_MAPPED);
> + __inc_zone_page_state(page, NR_ANON);
> }
>
> /**
> @@ -531,7 +531,7 @@ void page_remove_rmap(struct page *page)
> */
> if (page_test_and_clear_dirty(page))
> set_page_dirty(page);
> - __dec_zone_page_state(page, NR_MAPPED);
> + __dec_zone_page_state(page, PageAnon(page) ? NR_ANON : NR_MAPPED);
> }
> }

Can this accounting catch page migration ? TBD ?
Now all coutners are counted per zone, migration should be cared.

-Kame