From: wang lian <lianux.mm@gmail.com>
To: lorenzo.stoakes@oracle.com
Cc: Liam.Howlett@oracle.com, akpm@linux-foundation.org,
brauner@kernel.org, broonie@kernel.org, david@redhat.com,
gkwang@linx-info.com, jannh@google.com, lianux.mm@gmail.com,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-mm@kvack.org, p1ucky0923@gmail.com, ryncsn@gmail.com,
shuah@kernel.org, sj@kernel.org, vbabka@suse.cz,
zijing.zhang@proton.me, ziy@nvidia.com
Subject: Re: [PATCH v4] selftests/mm: add process_madvise() tests
Date: Fri, 11 Jul 2025 19:16:00 +0800 [thread overview]
Message-ID: <20250711111600.3989-1-lianux.mm@gmail.com> (raw)
In-Reply-To: <81f9a104-6d7d-4552-851e-8690d4a1b723@lucifer.local>
Hi Lorenzo Stoakes,
>> + *
>> + * This test deterministically validates process_madvise() with MADV_COLLAPSE
>> + * on a remote process, other advices are difficult to verify reliably.
>> + *
>> + * The test verifies that a memory region in a child process, initially
>> + * backed by small pages, can be collapsed into a Transparent Huge Page by a
>> + * request from the parent. The result is verified by parsing the child's
>> + * /proc/<pid>/smaps file.
>> + */
> This is clever and you've put a lot of effort in, but this just seems
> absolutely prone to flaking and you're essentially testing something that's
> highly automated.
> I think you're also going way outside of the realms of testing
> process_madvise() and are getting into testing essentially MADV_COLLAPSE
> here.
> We have to try to keep the test specific to what it is you're testing -
> which is process_madvise() itself.
> So for me, and I realise you've put a ton of work into this and I'm really
> sorry to say it, I think you should drop this specific test.
> For me simply testing the remote MADV_DONTNEED is enough.
My motivation for this complex test came from the need to verify that
the process_madvise operation was actually successful. Without checking
the outcome, the test would only validate that the syscall returns the
correct number of bytes, not that the advice truly took effect on the
target process's memory.
For remote calls, process_madvise is intentionally limited to
non-destructive advice: MADV_COLD, MADV_PAGEOUT, MADV_WILLNEED,
and MADV_COLLAPSE. However, verifying the effects of COLD, PAGEOUT,
and WILLNEED is very difficult to do reliably in a selftest. This left
MADV_COLLAPSE as what seemed to be the only verifiable option.
But, as you correctly pointed out, MADV_COLLAPSE is too dependent on
the system's THP state and prone to races with khugepaged. This is the
very issue I tried to work around in v4 after the v3 test failures.
So I think this test is necessary.
As for your other opinions, I completely agree.
Best regards,
Wang Lian
next prev parent reply other threads:[~2025-07-11 11:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-10 11:22 wang lian
2025-07-10 13:42 ` Mark Brown
2025-07-10 16:21 ` Zi Yan
2025-07-11 8:05 ` Mark Brown
2025-07-11 12:19 ` [PATCH v3] " wang lian
2025-07-10 16:57 ` [PATCH v4] " Lorenzo Stoakes
2025-07-11 8:11 ` Mark Brown
2025-07-11 8:53 ` Lorenzo Stoakes
2025-07-11 9:29 ` Mark Brown
2025-07-11 11:16 ` wang lian [this message]
2025-07-11 11:33 ` Lorenzo Stoakes
2025-07-11 12:02 ` wang lian
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=20250711111600.3989-1-lianux.mm@gmail.com \
--to=lianux.mm@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=broonie@kernel.org \
--cc=david@redhat.com \
--cc=gkwang@linx-info.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=p1ucky0923@gmail.com \
--cc=ryncsn@gmail.com \
--cc=shuah@kernel.org \
--cc=sj@kernel.org \
--cc=vbabka@suse.cz \
--cc=zijing.zhang@proton.me \
--cc=ziy@nvidia.com \
/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