[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aIOmm8cejmAyvSZ5@casper.infradead.org>
Date: Fri, 25 Jul 2025 16:45:31 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Xiaole He <hexiaole1994@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.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.
Powered by blists - more mailing lists