All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MM: handle THP in swap_*page_fs() - count_vm_events()
@ 2022-05-02  4:57 NeilBrown
  2022-05-02  5:16 ` Matthew Wilcox
  2022-05-02  5:31 ` [PATCH v2] " NeilBrown
  0 siblings, 2 replies; 8+ messages in thread
From: NeilBrown @ 2022-05-02  4:57 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: Andrew Morton, Geert Uytterhoeven, Christoph Hellwig, linux-nfs,
	linux-mm, linux-kernel


We need to use count_swpout_vm_event() for sio_write_complete() and
sio_read_complete(), to get correct counting.

This patch should be squased into
    MM: handle THP in swap_*page_fs()

Reported-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
 mm/page_io.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/mm/page_io.c b/mm/page_io.c
index d636a3531cad..3e2e9029ce50 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -280,8 +280,10 @@ static void sio_write_complete(struct kiocb *iocb, long ret)
 			set_page_dirty(page);
 			ClearPageReclaim(page);
 		}
-	} else
-		count_vm_events(PSWPOUT, sio->pages);
+	} else {
+		for (p = 0; p < sio->pages; p++)
+			count_swpout_vm_event(sio->bvec[p].bv_page);
+	}
 
 	for (p = 0; p < sio->pages; p++)
 		end_page_writeback(sio->bvec[p].bv_page);
@@ -390,9 +392,9 @@ static void sio_read_complete(struct kiocb *iocb, long ret)
 			struct page *page = sio->bvec[p].bv_page;
 
 			SetPageUptodate(page);
+			count_swpout_vm_event(page);
 			unlock_page(page);
 		}
-		count_vm_events(PSWPIN, sio->pages);
 	} else {
 		for (p = 0; p < sio->pages; p++) {
 			struct page *page = sio->bvec[p].bv_page;
-- 
2.36.0


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

end of thread, other threads:[~2022-05-09  9:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02  4:57 [PATCH] MM: handle THP in swap_*page_fs() - count_vm_events() NeilBrown
2022-05-02  5:16 ` Matthew Wilcox
2022-05-02  5:28   ` NeilBrown
2022-05-02  5:31     ` Matthew Wilcox
2022-05-06 17:26       ` Yang Shi
2022-05-09  8:56         ` Miaohe Lin
2022-05-02  5:31 ` [PATCH v2] " NeilBrown
2022-05-09  8:54   ` Miaohe Lin

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.