All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/shmem: shmem_replace_page() remember NR_SHMEM
@ 2022-08-11  5:06 Hugh Dickins
  2022-08-11 11:42 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Hugh Dickins @ 2022-08-11  5:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Matthew Wilcox, linux-kernel, linux-mm

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.

Signed-off-by: Hugh Dickins <hughd@google.com>
---
This is not terribly important, and will clash with one of Matthew's
59 for 5.21; I don't mind if this gets delayed, and we just do it again
on top of his series later, or he fold the equivalent into his series;
but thought I'd better send it in as another fix to shmem_replace_page()
while that function is on our minds.

 mm/shmem.c | 2 ++
 1 file changed, 2 insertions(+)

--- 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);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/shmem: shmem_replace_page() remember NR_SHMEM
  2022-08-11  5:06 [PATCH] mm/shmem: shmem_replace_page() remember NR_SHMEM Hugh Dickins
@ 2022-08-11 11:42 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2022-08-11 11:42 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Andrew Morton, linux-kernel, linux-mm

On Wed, Aug 10, 2022 at 10:06:33PM -0700, Hugh Dickins wrote:
> 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.
> 
> Signed-off-by: Hugh Dickins <hughd@google.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

> ---
> This is not terribly important, and will clash with one of Matthew's
> 59 for 5.21; I don't mind if this gets delayed, and we just do it again
> on top of his series later, or he fold the equivalent into his series;
> but thought I'd better send it in as another fix to shmem_replace_page()
> while that function is on our minds.

Let's get this into 6.0 since it's a bugfix, and I'll rebase my patches
for 6.1 on top of it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-11 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11  5:06 [PATCH] mm/shmem: shmem_replace_page() remember NR_SHMEM Hugh Dickins
2022-08-11 11:42 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.