[PATCH] mm : bail out from psi memstall after submit_bio in swap_readpage

From: Huangzhaoyang
Date: Tue Sep 07 2021 - 08:00:03 EST


From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>

It doesn't make sense to count IO time into psi memstall. Bail out after
bio submitted.

Signed-off-by: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>
---
mm/page_io.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/page_io.c b/mm/page_io.c
index c493ce9..1d131fc 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -423,6 +423,7 @@ int swap_readpage(struct page *page, bool synchronous)
count_vm_event(PSWPIN);
bio_get(bio);
qc = submit_bio(bio);
+ psi_memstall_leave(&pflags);
while (synchronous) {
set_current_state(TASK_UNINTERRUPTIBLE);
if (!READ_ONCE(bio->bi_private))
@@ -433,7 +434,7 @@ int swap_readpage(struct page *page, bool synchronous)
}
__set_current_state(TASK_RUNNING);
bio_put(bio);
-
+ return ret;
out:
psi_memstall_leave(&pflags);
return ret;
--
1.9.1