From: "Xiaole He" <hexiaole1994@126.com>
To: "Matthew Wilcox" <willy@infradead.org>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v1] mm/readahead: Optimize nr_to_read boundary check
Date: Sat, 26 Jul 2025 07:24:04 +0800 (GMT+08:00) [thread overview]
Message-ID: <28c0650a.4727.19843e6a1d8.Coremail.hexiaole1994@126.com> (raw)
In-Reply-To: <aIOmm8cejmAyvSZ5@casper.infradead.org>
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]
Thanks for your quick review and feedback.
I understand your points regarding the minimal performance impact and
the preference for keeping the current logic given its long-standing
correctness. I agree that the change is indeed minor in scope.
No worries at all, I appreciate you taking the time to consider the
patch.
Best regards,
| |
Xiaole He
|
|
hexiaole1994@126.com
|
---- Replied Message ----
| From | Matthew Wilcox<willy@infradead.org> |
| Date | 7/25/2025 23:45 |
| To | Xiaole He<hexiaole1994@126.com> |
| Cc | Andrew Morton<akpm@linux-foundation.org>,
<linux-fsdevel@vger.kernel.org>,
<linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org> |
| Subject | Re: [PATCH v1] mm/readahead: Optimize nr_to_read boundary check |
On Fri, Jul 25, 2025 at 11:28:34PM +0800, Xiaole He wrote:
If nr_to_read is, for instance, 3, and end_index - index + 1 is also 3
(meaning 3 pages remain), the condition 3 > 2 evaluates to true, leading
to nr_to_read being assigned 3 again. While compilers might optimize
this trivial self-assignment, it introduces unnecessary logical overhead
and reduces code clarity.
But it makes the initial comparison more complex (by one operation) and
I bet you can't measure the difference anyway. I'm not inclined to
tweak this.
[-- Attachment #2: Type: text/html, Size: 6121 bytes --]
prev parent reply other threads:[~2025-07-25 23:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 15:28 Xiaole He
2025-07-25 15:45 ` Matthew Wilcox
2025-07-25 23:24 ` Xiaole He [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=28c0650a.4727.19843e6a1d8.Coremail.hexiaole1994@126.com \
--to=hexiaole1994@126.com \
--cc=akpm@linux-foundation.org \
--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