Index: linux-2.6.15-rc2/include/linux/mmzone.h =================================================================== --- linux-2.6.15-rc2.orig/include/linux/mmzone.h 2005-11-23 04:33:25.000000000 +0000 +++ linux-2.6.15-rc2/include/linux/mmzone.h 2005-11-23 04:43:40.000000000 +0000 @@ -160,8 +160,9 @@ struct zone { unsigned long pages_scanned; /* since last reclaim */ int all_unreclaimable; /* All pages pinned */ - /* Count pages in the page cache */ + /* Page cache statistics for this zone */ atomic_t nr_pagecache; + atomic_t nr_mapped; /* * Does the allocator try to reclaim pages from the zone as soon @@ -329,9 +330,11 @@ extern struct pglist_data *pgdat_list; void __get_zone_counts(unsigned long *active, unsigned long *inactive, unsigned long *free, unsigned long *pagecache, + unsigned long *mapped, struct pglist_data *pgdat); void get_zone_counts(unsigned long *active, unsigned long *inactive, - unsigned long *free, unsigned long *pagecache); + unsigned long *free, unsigned long *pagecache, + unsigned long *mapped); void build_all_zonelists(void); void wakeup_kswapd(struct zone *zone, int order); int zone_watermark_ok(struct zone *z, int order, unsigned long mark, Index: linux-2.6.15-rc2/include/linux/page-flags.h =================================================================== --- linux-2.6.15-rc2.orig/include/linux/page-flags.h 2005-11-20 03:25:03.000000000 +0000 +++ linux-2.6.15-rc2/include/linux/page-flags.h 2005-11-23 04:38:55.000000000 +0000 @@ -85,7 +85,6 @@ struct page_state { unsigned long nr_writeback; /* Pages under writeback */ unsigned long nr_unstable; /* NFS unstable pages */ unsigned long nr_page_table_pages;/* Pages used for pagetables */ - unsigned long nr_mapped; /* mapped into pagetables */ unsigned long nr_slab; /* In slab */ #define GET_PAGE_STATE_LAST nr_slab Index: linux-2.6.15-rc2/mm/rmap.c =================================================================== --- linux-2.6.15-rc2.orig/mm/rmap.c 2005-11-23 04:31:25.000000000 +0000 +++ linux-2.6.15-rc2/mm/rmap.c 2005-11-23 04:38:01.000000000 +0000 @@ -459,7 +459,7 @@ void page_add_anon_rmap(struct page *pag page->index = linear_page_index(vma, address); - inc_page_state(nr_mapped); + atomic_inc(&page_zone(page)->nr_mapped); } /* else checking page index and mapping is racy */ } @@ -476,7 +476,7 @@ void page_add_file_rmap(struct page *pag BUG_ON(!pfn_valid(page_to_pfn(page))); if (atomic_inc_and_test(&page->_mapcount)) - inc_page_state(nr_mapped); + atomic_inc(&page_zone(page)->nr_mapped); } /** @@ -500,7 +500,7 @@ void page_remove_rmap(struct page *page) */ if (page_test_and_clear_dirty(page)) set_page_dirty(page); - dec_page_state(nr_mapped); + atomic_dec(&page_zone(page)->nr_mapped); } } Index: linux-2.6.15-rc2/mm/page_alloc.c =================================================================== --- linux-2.6.15-rc2.orig/mm/page_alloc.c 2005-11-23 04:33:25.000000000 +0000 +++ linux-2.6.15-rc2/mm/page_alloc.c 2005-11-23 05:11:34.000000000 +0000 @@ -1226,6 +1226,7 @@ EXPORT_SYMBOL(__mod_page_state); void __get_zone_counts(unsigned long *active, unsigned long *inactive, unsigned long *free, unsigned long *pagecache, + unsigned long *mapped, struct pglist_data *pgdat) { struct zone *zones = pgdat->node_zones; @@ -1239,12 +1240,13 @@ void __get_zone_counts(unsigned long *ac *inactive += zones[i].nr_inactive; *free += zones[i].free_pages; *pagecache += atomic_read(&zones[i].nr_pagecache); + *mapped += atomic_read(&zones[i].nr_mapped); } } void get_zone_counts(unsigned long *active, unsigned long *inactive, unsigned long *free, - unsigned long *pagecache) + unsigned long *pagecache, unsigned long *mapped) { struct pglist_data *pgdat; @@ -1253,12 +1255,13 @@ void get_zone_counts(unsigned long *acti *free = 0; *pagecache = 0; for_each_pgdat(pgdat) { - unsigned long l, m, n, p; - __get_zone_counts(&l, &m, &n, &p, pgdat); + unsigned long l, m, n, p, q; + __get_zone_counts(&l, &m, &n, &p, &q, pgdat); *active += l; *inactive += m; *free += n; *pagecache += p; + *mapped += q; } } @@ -1307,7 +1310,8 @@ void show_free_areas(void) unsigned long active; unsigned long inactive; unsigned long free; - unsigned long nr_pagecache; + unsigned long pagecache; + unsigned long mapped; struct zone *zone; for_each_zone(zone) { @@ -1337,7 +1341,7 @@ void show_free_areas(void) } get_page_state(&ps); - get_zone_counts(&active, &inactive, &free, &nr_pagecache); + get_zone_counts(&active, &inactive, &free, &pagecache,&mapped); printk("Free pages: %11ukB (%ukB HighMem)\n", K(nr_free_pages()), @@ -1351,9 +1355,9 @@ void show_free_areas(void) ps.nr_writeback, ps.nr_unstable, nr_free_pages(), - nr_pagecache, + pagecache, ps.nr_slab, - ps.nr_mapped, + mapped, ps.nr_page_table_pages); for_each_zone(zone) { @@ -1993,6 +1997,8 @@ static void __init free_area_init_core(s zone->nr_scan_inactive = 0; zone->nr_active = 0; zone->nr_inactive = 0; + atomic_set(&zone->nr_pagecache, 0); + atomic_set(&zone->nr_mapped, 0); atomic_set(&zone->reclaim_in_progress, 0); if (!size) continue; Index: linux-2.6.15-rc2/drivers/base/node.c =================================================================== --- linux-2.6.15-rc2.orig/drivers/base/node.c 2005-11-23 04:33:25.000000000 +0000 +++ linux-2.6.15-rc2/drivers/base/node.c 2005-11-23 05:03:10.000000000 +0000 @@ -44,18 +44,18 @@ static ssize_t node_read_meminfo(struct unsigned long active; unsigned long free; unsigned long pagecache; + unsigned long mapped; si_meminfo_node(&i, nid); get_page_state_node(&ps, nid); - __get_zone_counts(&active, &inactive, &free, &pagecache, NODE_DATA(nid)); + __get_zone_counts(&active, &inactive, &free, &pagecache, &mapped, + NODE_DATA(nid)); /* Check for negative values in these approximate counters */ if ((long)ps.nr_dirty < 0) ps.nr_dirty = 0; if ((long)ps.nr_writeback < 0) ps.nr_writeback = 0; - if ((long)ps.nr_mapped < 0) - ps.nr_mapped = 0; if ((long)ps.nr_slab < 0) ps.nr_slab = 0; @@ -86,7 +86,7 @@ static ssize_t node_read_meminfo(struct nid, K(ps.nr_dirty), nid, K(ps.nr_writeback), nid, K(pagecache), - nid, K(ps.nr_mapped), + nid, K(mapped), nid, K(ps.nr_slab)); n += hugetlb_report_node_meminfo(nid, buf + n); return n; Index: linux-2.6.15-rc2/fs/proc/proc_misc.c =================================================================== --- linux-2.6.15-rc2.orig/fs/proc/proc_misc.c 2005-11-23 04:33:25.000000000 +0000 +++ linux-2.6.15-rc2/fs/proc/proc_misc.c 2005-11-23 05:00:37.000000000 +0000 @@ -125,13 +125,14 @@ static int meminfo_read_proc(char *page, unsigned long active; unsigned long free; unsigned long pagecache; + unsigned long mapped; unsigned long committed; unsigned long allowed; struct vmalloc_info vmi; long cached; get_page_state(&ps); - get_zone_counts(&active, &inactive, &free, &pagecache); + get_zone_counts(&active, &inactive, &free, &pagecache, &mapped); /* * display in kilobytes. @@ -191,7 +192,7 @@ static int meminfo_read_proc(char *page, K(i.freeswap), K(ps.nr_dirty), K(ps.nr_writeback), - K(ps.nr_mapped), + K(mapped), K(ps.nr_slab), K(allowed), K(committed), Index: linux-2.6.15-rc2/mm/mmap.c =================================================================== --- linux-2.6.15-rc2.orig/mm/mmap.c 2005-11-23 04:33:25.000000000 +0000 +++ linux-2.6.15-rc2/mm/mmap.c 2005-11-23 04:58:40.000000000 +0000 @@ -93,9 +93,9 @@ int __vm_enough_memory(long pages, int c return 0; if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) { - unsigned long n, pfree, pagecache; + unsigned long n, pfree, pagecache, mapped; - get_zone_counts(&n, &n, &pfree, &pagecache); + get_zone_counts(&n, &n, &pfree, &pagecache, &mapped); if (!cap_sys_admin) pfree -= pfree / 32; Index: linux-2.6.15-rc2/mm/page-writeback.c =================================================================== --- linux-2.6.15-rc2.orig/mm/page-writeback.c 2005-11-20 03:25:03.000000000 +0000 +++ linux-2.6.15-rc2/mm/page-writeback.c 2005-11-23 04:46:53.000000000 +0000 @@ -111,7 +111,8 @@ static void get_writeback_state(struct w { wbs->nr_dirty = read_page_state(nr_dirty); wbs->nr_unstable = read_page_state(nr_unstable); - wbs->nr_mapped = read_page_state(nr_mapped); + wbs->nr_mapped = 0; +// wbs->nr_mapped = read_page_state(nr_mapped); wbs->nr_writeback = read_page_state(nr_writeback); } Index: linux-2.6.15-rc2/mm/readahead.c =================================================================== --- linux-2.6.15-rc2.orig/mm/readahead.c 2005-11-23 04:33:25.000000000 +0000 +++ linux-2.6.15-rc2/mm/readahead.c 2005-11-23 04:47:37.000000000 +0000 @@ -566,7 +566,9 @@ unsigned long max_sane_readahead(unsigne unsigned long inactive; unsigned long free; unsigned long pagecache; + unsigned long mapped; - __get_zone_counts(&active, &inactive, &free, &pagecache, NODE_DATA(numa_node_id())); + __get_zone_counts(&active, &inactive, &free, &pagecache, &mapped, + NODE_DATA(numa_node_id())); return min(nr, (inactive + free) / 2); }