Re: [PATCH] selftests/mm: move the HMM migration benchmark out of selftests

From: Mika Penttilä

Date: Thu Nov 26 2026 - 04:54:19 EST




On 11/26/26 08:41, David Hildenbrand (Arm) wrote:
> On 11/26/26 03:56, Balbir Singh wrote:
>> The HMM selftest runs benchmark_thp_migration on every invocation.
>> The benchmark repeatedly migrates buffers in both directions to measure
>> latency and throughput with and without THP. Run it on demand so the
>> regular suite spends its time checking correctness.
>>
>> Move the benchmark into its own hmm-bench binary and share the device
>> fixture, buffer helpers and migration ioctls with hmm-tests. To run it:
>>
>> make -C tools/testing/performance-tests/mm
>> sudo modprobe test_hmm
>> sudo tools/testing/performance-tests/mm/hmm-bench
>>
>> Drop the 128-PMD buffer to bound the amount of memory migrated in one
>> measurement. With 2 MiB PMDs, the largest buffer falls from 256 MiB to
>> 16 MiB. The remaining sizes still cover buffers smaller than a PMD, a
>> single PMD and multiple PMDs, with and without MADV_HUGEPAGE.
>>
>> Call fflush(stdout) after printing the results for each buffer size.
>> The kselftest harness ends the test child with _exit(0), so timing
>> results still buffered in stdout can be lost when output is redirected
>> to a file or pipe.
> There was recently a discussion on where to put performance tests. Usually it's
> much rather tools to test performance.
>
> So what about tools/mm/ instead, where we also placed gup_bench.c ?
>
The slimmed down test runs very quickly and with less memory pressure already, so maybe not a big issue keeping that in hmm-tests either, i see the value of having all HMM tests in one test.
But tools/mm sounds a logical place if want to separate tests.

--Mika