From: Chi Zhiling <chizhiling@163.com>
To: akpm@linux-foundation.org, willy@infradead.org
Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Chi Zhiling <chizhiling@kylinos.cn>
Subject: [RFC PATCH 3/3] mm/filemap: Skip non-uptodate folio when folios are available
Date: Wed, 23 Jul 2025 18:18:25 +0800 [thread overview]
Message-ID: <20250723101825.607184-4-chizhiling@163.com> (raw)
In-Reply-To: <20250723101825.607184-1-chizhiling@163.com>
From: Chi Zhiling <chizhiling@kylinos.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@kylinos.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
prev parent reply other threads:[~2025-07-23 10:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-23 10:18 [RFC PATCH 0/3] Tiny optimization for large read operations Chi Zhiling
2025-07-23 10:18 ` [RFC PATCH 1/3] mm/filemap: Do not use is_partially_uptodate for entire folio Chi Zhiling
2025-07-23 10:18 ` [RFC PATCH 2/3] mm/filemap: Avoid modifying iocb->ki_flags for AIO in filemap_get_pages() Chi Zhiling
2025-07-23 14:33 ` Matthew Wilcox
2025-07-24 1:54 ` Chi Zhiling
2025-07-23 10:18 ` Chi Zhiling [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250723101825.607184-4-chizhiling@163.com \
--to=chizhiling@163.com \
--cc=akpm@linux-foundation.org \
--cc=chizhiling@kylinos.cn \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®