lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250723101825.607184-4-chizhiling@163.com>
Date: Wed, 23 Jul 2025 18:18:25 +0800
From: Chi Zhiling <chizhiling@....com>
To: akpm@...ux-foundation.org,
	willy@...radead.org
Cc: linux-fsdevel@...r.kernel.org,
	linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Chi Zhiling <chizhiling@...inos.cn>
Subject: [RFC PATCH 3/3] mm/filemap: Skip non-uptodate folio when folios are available

From: Chi Zhiling <chizhiling@...inos.cn>

This optimization primarily targets read operations that trigger multiple
IOs, aiming to complete the copy from cache to user buffer as quickly as
possible after the final IO completes.

This patch achieves the goal by minimizing the number of folios left for
the final copy loop.

In filemap_get_pages(), when encountering a non-uptodate folio while the
fbatch already contains folios, we skip waiting for the non-uptodate folio
and proceed to copy the available folios.

Signed-off-by: Chi Zhiling <chizhiling@...inos.cn>
---
 mm/filemap.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index 350080f579ef..894584a5bff5 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2625,13 +2625,9 @@ static int filemap_get_pages(struct kiocb *iocb, size_t count,
 			goto err;
 	}
 	if (!folio_test_uptodate(folio)) {
-		bool no_wait = false;
-
-		if ((iocb->ki_flags & IOCB_WAITQ) &&
-		    folio_batch_count(fbatch) > 1)
-			no_wait = true;
 		err = filemap_update_page(iocb, mapping, count, folio,
-					  need_uptodate, no_wait);
+					  need_uptodate,
+					  folio_batch_count(fbatch) > 1);
 		if (err)
 			goto err;
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ