Re: [PATCH v7 0/6] selftests/mm: separate GUP microbenchmarking from functional testing

Usama Anjum <[email protected]>
Newsgroups org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kvack.linux-mm
Message-ID <[email protected]>
On 13/08/2026 7:12 pm, Sarthak Sharma wrote:
> gup_test.c currently serves two separate purposes: benchmarking
> (GUP_FAST_BENCHMARK, PIN_FAST_BENCHMARK and PIN_LONGTERM_BENCHMARK) and
> functional testing (GUP_BASIC_TEST, PIN_BASIC_TEST and
> DUMP_USER_PAGES_TEST). Keeping both in one program makes the functional
> tests harder to run and report individually, while run_vmtests.sh has to
> invoke the program repeatedly with different options.
> 
> Separate these roles into tools/mm/gup_bench for benchmarking and
> tools/testing/selftests/mm/gup for functional testing. Move the shared
> file and hugepage helpers to tools/lib/mm/ so both programs can use them
> without duplicating the implementation.
> 
> Patch 1 makes read_file(), write_file(), read_num(), write_num() and
> write_num_ignore_einval() return errors to their callers instead of
> exiting. It also makes read_num() reject negative and malformed values
> and updates the existing callers to handle failures.
> 
> Patch 2 moves these file helpers from vm_util.c to tools/lib/mm/. It keeps
> them available to the mm selftests through vm_util.h and adjusts the
> selftests build accordingly.
> 
> Patch 3 moves hugepage_settings.[ch] from selftests/mm to tools/lib/mm/.
> It also removes its kselftest dependency while preserving TAP-compatible
> diagnostics for selftest users.
> 
> Patch 4 moves the existing gup_test implementation from selftests/mm to
> tools/mm as gup_bench. This keeps the code movement separate from the
> subsequent changes and makes it easier to review.
> 
> Patch 5 removes the functional test modes and kselftest dependency from
> gup_bench. When run without arguments, it performs one GUP_FAST benchmark
> using the existing defaults instead of running the whole matrix. Other
> benchmark configurations can be selected through command-line options.
> 
> Patch 6 adds a new harness-based GUP selftest. It covers THP, non-THP and
> HugeTLB mappings across private/shared and read/write variants. For each
> variant, it tests get_user_pages(), get_user_pages_fast(),
> pin_user_pages(), pin_user_pages_fast(), long-term pinning and both dump
> modes using four batch sizes. It also preserves the existing sparse dump
> coverage for pages 0, 19 and 0x1000. The HugeTLB variants share a one-time
> setup of 128 default-sized huge pages.

I tested the full MM selftest suite before and after this series and found
no regressions. The new GUP selftest and gup_bench also passed.

Tested-by: Muhammad Usama Anjum <[email protected]>

Thanks,
Usama
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.