[PATCH] [66/99] migrate: don't account swapcache as shmem

From: Andi Kleen
Date: Wed Jul 27 2011 - 17:58:22 EST


2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Andrea Arcangeli <aarcange@xxxxxxxxxx>

commit 99a15e21d96f6857dafab1e5167e5e8183215c9c upstream.

swapcache will reach the below code path in migrate_page_move_mapping,
and swapcache is accounted as NR_FILE_PAGES but it's not accounted as
NR_SHMEM.

Hugh pointed out we must use PageSwapCache instead of comparing
mapping to &swapper_space, to avoid build failure with CONFIG_SWAP=n.

Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Acked-by: Hugh Dickins <hughd@xxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>

---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.35.y/mm/migrate.c
===================================================================
--- linux-2.6.35.y.orig/mm/migrate.c
+++ linux-2.6.35.y/mm/migrate.c
@@ -266,7 +266,7 @@ static int migrate_page_move_mapping(str
*/
__dec_zone_page_state(page, NR_FILE_PAGES);
__inc_zone_page_state(newpage, NR_FILE_PAGES);
- if (PageSwapBacked(page)) {
+ if (!PageSwapCache(page) && PageSwapBacked(page)) {
__dec_zone_page_state(page, NR_SHMEM);
__inc_zone_page_state(newpage, NR_SHMEM);
}
--
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/