From: Andrea Arcangeli Date: Thu, 16 Jun 2011 19:56:19 +0000 (-0700) Subject: migrate: don't account swapcache as shmem X-Git-Tag: v2.6.35.14~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a67f6f3794586c33e430d8a8e61d0548d33a3abe;p=thirdparty%2Fkernel%2Fstable.git migrate: don't account swapcache as shmem 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 Acked-by: Hugh Dickins Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andi Kleen --- diff --git a/mm/migrate.c b/mm/migrate.c index 4205b1d6049ed..ca71d064bce7c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -266,7 +266,7 @@ static int migrate_page_move_mapping(struct address_space *mapping, */ __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); }