]> Git Repo - linux.git/commitdiff
mm/shmem: shmem_replace_page() remember NR_SHMEM
authorHugh Dickins <[email protected]>
Thu, 11 Aug 2022 05:06:33 +0000 (22:06 -0700)
committerAndrew Morton <[email protected]>
Sat, 20 Aug 2022 22:17:45 +0000 (15:17 -0700)
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]>
mm/shmem.c

index ce2090744c5e4745e72353bc148a656e785c2aa8..d075dd2dcc484a57f298e8739257927bc9635fcc 100644 (file)
@@ -1659,7 +1659,9 @@ static int shmem_replace_page(struct page **pagep, gfp_t gfp,
                new = page_folio(newpage);
                mem_cgroup_migrate(old, new);
                __inc_lruvec_page_state(newpage, NR_FILE_PAGES);
+               __inc_lruvec_page_state(newpage, NR_SHMEM);
                __dec_lruvec_page_state(oldpage, NR_FILE_PAGES);
+               __dec_lruvec_page_state(oldpage, NR_SHMEM);
        }
        xa_unlock_irq(&swap_mapping->i_pages);
 
This page took 0.057178 seconds and 4 git commands to generate.