diff options
author | Hugh Dickins <hughd@google.com> | 2022-08-10 22:06:33 -0700 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2022-08-20 15:17:45 -0700 |
commit | 76d36dea02691a8ffa8cd7368eecbf727b8a1c0c (patch) | |
tree | dec5291667487401c33c1042c58eae90055c8feb | |
parent | 15f242bb65b89d5f1ff990668a586fdf1307b2c8 (diff) | |
download | linux-76d36dea02691a8ffa8cd7368eecbf727b8a1c0c.tar.gz linux-76d36dea02691a8ffa8cd7368eecbf727b8a1c0c.tar.bz2 linux-76d36dea02691a8ffa8cd7368eecbf727b8a1c0c.zip |
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>
-rw-r--r-- | mm/shmem.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index ce2090744c5e..d075dd2dcc48 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -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); |