From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Dev Jain <dev.jain@arm.com>, akpm@linux-foundation.org, shuah@kernel.org
Cc: ljs@kernel.org, Liam.Howlett@oracle.com, vbabka@kernel.org,
rppt@kernel.org, surenb@google.com, mhocko@suse.com,
linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org, ryan.roberts@arm.com,
anshuman.khandual@arm.com,
Sarthak Sharma <sarthak.sharma@arm.com>
Subject: Re: [PATCH v2] selftests/mm: Simplify byte pattern checking in mremap_test
Date: Wed, 15 Apr 2026 09:48:14 +0200 [thread overview]
Message-ID: <2e34b619-085f-4a9c-bb41-bc024fd40dd7@kernel.org> (raw)
In-Reply-To: <20260415044509.579428-1-dev.jain@arm.com>
On 4/15/26 06:45, Dev Jain wrote:
> The original version of mremap_test (7df666253f26: "kselftests: vm: add
> mremap tests") validated remapped contents byte-by-byte and printed a
> mismatch index in case the bytes streams didn't match. That was rather
> inefficient, especially also if the test passed.
>
> Later, commit 7033c6cc9620 ("selftests/mm: mremap_test: optimize
> execution time from minutes to seconds using chunkwise memcmp") used
> memcmp() on bigger chunks, to fallback to byte-wise scanning to detect
> the problematic index only if it discovered a problem.
>
> However, the implementation is overly complicated (e.g., get_sqrt() is
> currently not optimal) and we don't really have to report the exact
> index: whoever debugs the failing test can figure that out.
>
> Let's simplify by just comparing both byte streams with memcmp() and not
> detecting the exact failed index.
>
> Reported-by: Sarthak Sharma <sarthak.sharma@arm.com>
> Tested-by: Sarthak Sharma <sarthak.sharma@arm.com>
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
I'll note something interesting: before 7033c6cc9620, we would check
random bytes in the stream. With 7033c6cc9620 we only check the first
threshold bytes IIUC.
That means, that we are not actually verifying most of the area at all
anymore?
The whole test options are extremely questionable:
$ ./mremap_test --help
./mremap_test: invalid option -- '-'
Usage: ./mremap_test [[-t <threshold_mb>] [-p <pattern_seed>]]
-t only validate threshold_mb of the remapped region
if 0 is supplied no threshold is used; all tests
are run and remapped regions validated fully.
The default threshold used is 4MB.
-p provide a seed to generate the random pattern for
validating the remapped region.
Nobody will ever set these parameters, really. And tests that test
different things each time they are run are not particularly helpful.
We should just remove all that and do something reasonable internally.
That is
a) Remove all the perf crap (ehm sorry, "advanced tests that don't
belong here and that nobody ever runs") from this functional test
b) Remove all options from the test. Nobody ever uses them. They are
stupid.
c) Remove any randomization from the test. There is no need for random
patterns, just fill pages with increasing numbers.
d) Just always verify the whole regions. Without the rand() magic this
will probably be just ... fairly fast?
--
Cheers,
David
next prev parent reply other threads:[~2026-04-15 7:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 4:45 Dev Jain
2026-04-15 6:00 ` Mike Rapoport
2026-04-15 7:48 ` David Hildenbrand (Arm) [this message]
2026-04-15 8:35 ` Dev Jain
2026-04-15 8:50 ` David Hildenbrand (Arm)
2026-04-15 9:16 ` David Laight
2026-04-15 9:21 ` David Hildenbrand (Arm)
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=2e34b619-085f-4a9c-bb41-bc024fd40dd7@kernel.org \
--to=david@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=dev.jain@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=sarthak.sharma@arm.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@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