Skip to content

Commit 76d36de

Browse files
Hugh Dickinsakpm00
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/cec7c09d-5874-e160-ada6-6e10ee48784@google.com Signed-off-by: Hugh Dickins <hughd@google.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: "Darrick J. Wong" <djwong@kernel.org> Cc: Radoslaw Burny <rburny@google.com> Cc: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
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)