[RFC 6/8] Account for pages in the page cache in terms of base pages

From: Christoph Lameter
Date: Thu Apr 19 2007 - 12:36:18 EST


Variable Order Page Cache: Account for higher order pages

NR_FILE_PAGES now counts pages of different order. Maybe we need to
account in base page sized pages? If so then we need to change
the way we update the counters. Note that the same would have to be
done for other counters.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>


---
mm/filemap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6.21-rc7/mm/filemap.c
===================================================================
--- linux-2.6.21-rc7.orig/mm/filemap.c 2007-04-19 09:11:13.000000000 -0700
+++ linux-2.6.21-rc7/mm/filemap.c 2007-04-19 09:14:16.000000000 -0700
@@ -119,7 +119,8 @@ void __remove_from_page_cache(struct pag
radix_tree_delete(&mapping->page_tree, page->index);
page->mapping = NULL;
mapping->nrpages--;
- __dec_zone_page_state(page, NR_FILE_PAGES);
+ __mod_zone_page_state(page_zone(page), NR_FILE_PAGES,
+ -(1 << mapping->order));
}

void remove_from_page_cache(struct page *page)
@@ -448,7 +449,8 @@ int add_to_page_cache(struct page *page,
page->mapping = mapping;
page->index = offset;
mapping->nrpages++;
- __inc_zone_page_state(page, NR_FILE_PAGES);
+ __mod_zone_page_state(page_zone(page), NR_FILE_PAGES,
+ 1 << mappig->order);
}
write_unlock_irq(&mapping->tree_lock);
radix_tree_preload_end();
-
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/