From: 王翊嘉 <wangyijia.yeah@bytedance.com>
To: <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>, <linux-kselftest@vger.kernel.org>,
<linux-mm@kvack.org>, <muchun.song@linux.dev>,
<shuah@kernel.org>, <wangyijia.yeah@bytedance.com>
Subject: Re: [PATCH RESEND v3] selftests: mincore: fix the readahead check on large base page sizes
Date: Tue, 7 Jul 2026 14:25:05 +0800 [thread overview]
Message-ID: <20260707062505.3171552-1-wangyijia.yeah@bytedance.com> (raw)
In-Reply-To: <20260704203616.1ce10365e07c746f1e805cab@linux-foundation.org>
On Sat, Jul 04, 2026 at 08:36:16PM -0700, Andrew Morton wrote:
> I'm not sure this is a good thing for us to be self-testing for. It's
> poking pretty deeply inside the internal implementations of
> kernel-of-the-moment.
>
> Oh well, I guss if the test suddenly starts reporting errors, it might
> be something we want to look into.
>
> Thanks. AI review might have found a couple of things of interest:
> https://sashiko.dev/#/patchset/20260703125253.3016281-1-wangyijia.yeah@bytedance.com
Thanks for taking a look.
After thinking more about your concern, I agree that teaching this
selftest how to compute the expected readahead window from sysfs
read_ahead_kb is probably not the right direction. The failure is related
to mmap read-around behaviour, but adding that policy knowledge to the
test makes it depend even more on implementation details.
The actual failure I was trying to fix is narrower. The existing test
already expects a neighbouring page to become resident after faulting the
middle of the mapping, but it only scans after the faulted page. On the
64K-page arm64 system where I reproduced this, with the default 128K
read_ahead_kb setting, the file-backed mmap fault on page 32 makes pages
31 and 32 resident. The original test scans from page 33 onwards, misses
the resident neighbour at page 31, and reports ra_pages == 0.
I tested a smaller version which drops the readahead_window_pages()
helper and the new skip logic, and only changes the existing check to
scan both sides of the faulted page. On the same 64K-page system, the
original test fails reliably, while that smaller change passes. So the
sysfs/read_ahead_kb logic does not appear to be needed to fix the 64K
failure.
I am thinking of sending a v4 in that direction: keep the existing
EXPECT_GT(ra_pages, 0) check, but make it count resident neighbouring
pages on both sides of the faulted page, without trying to compute the
expected readahead window in the test.
The other possible direction is to remove the readahead assertion from
check_file_mmap entirely, similar to the tmpfs case, and only verify that
the faulted page itself becomes resident. That would avoid testing this
implementation detail, but it would also drop the existing coverage.
Would you prefer one of these approaches?
Thanks,
Yijia
next prev parent reply other threads:[~2026-07-07 6:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 12:52 Yijia Wang
2026-07-05 3:36 ` Andrew Morton
2026-07-07 6:25 ` 王翊嘉 [this message]
2026-07-07 21:23 ` Andrew Morton
2026-07-08 7:59 ` [PATCH v4] selftests: mincore: count file-mmap readahead on both sides 王翊嘉
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=20260707062505.3171552-1-wangyijia.yeah@bytedance.com \
--to=wangyijia.yeah@bytedance.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=shuah@kernel.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®