Skip to content

Commit 99a15e2

Browse files
aagittorvalds
authored andcommitted
migrate: don't account swapcache as shmem
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@redhat.com> Acked-by: Hugh Dickins <hughd@google.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 7cc2ed0 commit 99a15e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/migrate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
288288
*/
289289
__dec_zone_page_state(page, NR_FILE_PAGES);
290290
__inc_zone_page_state(newpage, NR_FILE_PAGES);
291-
if (PageSwapBacked(page)) {
291+
if (!PageSwapCache(page) && PageSwapBacked(page)) {
292292
__dec_zone_page_state(page, NR_SHMEM);
293293
__inc_zone_page_state(newpage, NR_SHMEM);
294294
}

0 commit comments

Comments
 (0)