Linux Documentation
 help / color / mirror / Atom feed
From: Dev Jain <dev.jain@arm.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
	Sarthak Sharma <sarthak.sharma@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R . Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>, Shuah Khan <shuah@kernel.org>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
	Leon Romanovsky <leon@kernel.org>, Zi Yan <ziy@nvidia.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	Nico Pache <npache@redhat.com>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
	Jonathan Corbet <corbet@lwn.net>, Mark Brown <broonie@kernel.org>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 4/5] tools/mm: add a standalone GUP microbenchmark
Date: Fri, 24 Jul 2026 17:35:44 +0530	[thread overview]
Message-ID: <75259d8f-1cdf-43e4-9fa4-9a2954435a96@arm.com> (raw)
In-Reply-To: <4665dd2d-99c8-492c-a4cf-b72028317d0b@kernel.org>



On 21/07/26 7:22 pm, David Hildenbrand (Arm) wrote:
> On 7/16/26 14:32, Sarthak Sharma wrote:
>> Add a command-line tool for benchmarking get_user_pages fast-path
>> (GUP_FAST), pin_user_pages fast-path (PIN_FAST), and pin_user_pages
>> longterm (PIN_LONGTERM) via the CONFIG_GUP_TEST debugfs interface.
>>
>> When invoked without arguments, gup_bench runs the benchmark subset
>> of configurations covered by run_gup_matrix() in run_vmtests.sh: all
> 
> To we really need the matrix in there? The matrix was good for selftests, but
> not when using it as a benchmarking tool, no?
> 
>> three GUP commands across read/write, private/shared mappings, and a
>> range of page counts, with THP on/off for regular mappings and hugetlb
>> for huge page mappings. Restore HugeTLB settings after each hugetlb
>> benchmark run. Validate numeric command-line arguments instead of
>> relying on atoi().
>>
>> This tool is a mix of reused and new logic. The mapping/setup path comes
>> from selftests/mm/gup_test.c, while the default benchmark matrix matches
>> the benchmark subset of run_gup_matrix() in run_vmtests.sh. The standalone
>> CLI and tools/mm integration are added here and the HugeTLB setup code is
>> shared via tools/lib/mm.
>>
>> Add gup_bench to BUILD_TARGETS and INSTALL_TARGETS in tools/mm/Makefile,
>> link it against the shared tools/lib/mm hugepage helpers, and ignore the
>> resulting binary in tools/mm/.gitignore. While here, also add the
>> missing thp_swap_allocator_test entry to .gitignore.
>>
>> Add tools/mm/gup_bench.c to the GUP entry in MAINTAINERS.
>>
>> Suggested-by: David Hildenbrand (Arm) <david@kernel.org>
>> Signed-off-by: Sarthak Sharma <sarthak.sharma@arm.com>
>> ---
>>  MAINTAINERS          |   1 +
>>  tools/mm/.gitignore  |   2 +
>>  tools/mm/Makefile    |  10 +-
>>  tools/mm/gup_bench.c | 482 +++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 492 insertions(+), 3 deletions(-)
>>  create mode 100644 tools/mm/gup_bench.c
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 26b06d80ab45..7d121dee9f0f 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -17024,6 +17024,7 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
>>  F:	mm/gup.c
>>  F:	mm/gup_test.c
>>  F:	mm/gup_test.h
>> +F:	tools/mm/gup_bench.c
>>  F:	tools/testing/selftests/mm/gup_longterm.c
>>  F:	tools/testing/selftests/mm/gup_test.c
>>  
>> diff --git a/tools/mm/.gitignore b/tools/mm/.gitignore
>> index 922879f93fc8..154d740be02e 100644
>> --- a/tools/mm/.gitignore
>> +++ b/tools/mm/.gitignore
>> @@ -2,3 +2,5 @@
>>  slabinfo
>>  page-types
>>  page_owner_sort
>> +thp_swap_allocator_test
> 
> ^ Does that belong into this patch?
> 
>> +gup_bench
> 
> I wonder if it makes sense to "git mv" the existing tool (only slightly fixing
> header inclusion to make it compile), essentially removing the old benchmark.
> 
> So it would be
> 
> 1) Move tools, fixing up includes and removing the gup testing logic+matrix to
>    make it compile

I like your idea, it would reduce churn. But is it okay that there will be an
intermediate state in which gup_test is not there? Wouldn't we call this a
"regression"?


> 
> 2) Extend tool by XYZ
> 
> 3) Add completely new selftest
> 
> Because looking at patch #5, there is not really any code reuse there, but I
> suspect there should be some in this patch here when moving instead of copying.
> 
> That would make this a lot easier to review.
> 


  parent reply	other threads:[~2026-07-24 12:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16 12:32 [PATCH v5 0/5] selftests/mm: separate GUP microbenchmarking from functional testing Sarthak Sharma
2026-07-16 12:32 ` [PATCH v5 1/5] selftests/mm: make file helpers return errors Sarthak Sharma
2026-07-21 13:39   ` David Hildenbrand (Arm)
2026-07-21 13:48     ` Mark Brown
2026-07-21 14:54       ` David Hildenbrand (Arm)
2026-07-22  5:24         ` Sarthak Sharma
2026-07-22 18:57           ` John Hubbard
2026-07-27 17:49             ` David Hildenbrand (Arm)
2026-07-16 12:32 ` [PATCH v5 2/5] tools/lib/mm: add shared file helpers Sarthak Sharma
2026-07-16 12:32 ` [PATCH v5 3/5] tools/lib/mm: move hugepage_settings out of selftests Sarthak Sharma
2026-07-16 12:32 ` [PATCH v5 4/5] tools/mm: add a standalone GUP microbenchmark Sarthak Sharma
2026-07-21 13:52   ` David Hildenbrand (Arm)
2026-07-22  4:38     ` Sarthak Sharma
2026-07-27 17:49       ` David Hildenbrand (Arm)
2026-07-24 12:05     ` Dev Jain [this message]
2026-07-27 17:51       ` David Hildenbrand (Arm)
2026-07-16 12:32 ` [PATCH v5 5/5] selftests/mm: rewrite gup_test as a standalone harness-based selftest Sarthak Sharma
2026-07-20 12:01 ` [PATCH v5 0/5] selftests/mm: separate GUP microbenchmarking from functional testing Sarthak Sharma

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=75259d8f-1cdf-43e4-9fa4-9a2954435a96@arm.com \
    --to=dev.jain@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=anshuman.khandual@arm.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=david@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=jhubbard@nvidia.com \
    --cc=lance.yang@linux.dev \
    --cc=leon@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --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=npache@redhat.com \
    --cc=peterx@redhat.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=sarthak.sharma@arm.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --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