Skip to content

Commit 76d36de

Browse files
Hugh Dickinsakpm00
Hugh Dickins
authored andcommitted
mm/shmem: shmem_replace_page() remember NR_SHMEM
Elsewhere, NR_SHMEM is updated at the same time as shmem NR_FILE_PAGES; but shmem_replace_page() was forgetting to do that - so NR_SHMEM stats could grow too big or too small, in those unusual cases when it's used. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Hugh Dickins <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Cc: "Darrick J. Wong" <[email protected]> Cc: Radoslaw Burny <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 15f242b commit 76d36de

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mm/shmem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,9 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp,
16591659
new = page_folio(newpage);
16601660
mem_cgroup_migrate(old, new);
16611661
__inc_lruvec_page_state(newpage, NR_FILE_PAGES);
1662+
__inc_lruvec_page_state(newpage, NR_SHMEM);
16621663
__dec_lruvec_page_state(oldpage, NR_FILE_PAGES);
1664+
__dec_lruvec_page_state(oldpage, NR_SHMEM);
16631665
}
16641666
xa_unlock_irq(&swap_mapping->i_pages);
16651667

0 commit comments

Comments
 (0)