* [PATCH] mm/gup_test: report actual pinned bytes
@ 2026-08-31 6:48 Sarthak Sharma
2026-08-31 9:00 ` Kiryl Shutsemau
0 siblings, 1 reply; 2+ messages in thread
From: Sarthak Sharma @ 2026-08-31 6:48 UTC (permalink / raw)
To: Andrew Morton, David Hildenbrand
Cc: Jason Gunthorpe, John Hubbard, Peter Xu, Kiryl Shutsemau,
linux-mm, linux-kernel, Sarthak Sharma
__gup_test_ioctl() advances addr to the end of the current batch before
checking if GUP pinned the entire requested batch. If GUP pins more than
0 pages but less that the requested batch size, addr still advances by
the requested batch size.
The next iteration detects the partial pinning and breaks out of the loop.
Again gup->size is calculated using addr - gup->addr, so it also includes
the unpinned pages of the requested batch.
Calculate gup->size using the actual number of pages pinned multiplied
by PAGE_SIZE.
Fixes: 64c349f4ae78 ("mm: add infrastructure for get_user_pages_fast() benchmarking")
Signed-off-by: Sarthak Sharma <sarthak.sharma@arm.com>
---
mm/gup_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/gup_test.c b/mm/gup_test.c
index 44c1cdfb9c37..185ba3bb8ed1 100644
--- a/mm/gup_test.c
+++ b/mm/gup_test.c
@@ -188,7 +188,7 @@ static int __gup_test_ioctl(unsigned int cmd,
nr_pages = i;
gup->get_delta_usec = ktime_us_delta(end_time, start_time);
- gup->size = addr - gup->addr;
+ gup->size = nr_pages * PAGE_SIZE;
/*
* Take an un-benchmark-timed moment to verify DMA pinned
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm/gup_test: report actual pinned bytes
2026-08-31 6:48 [PATCH] mm/gup_test: report actual pinned bytes Sarthak Sharma
@ 2026-08-31 9:00 ` Kiryl Shutsemau
0 siblings, 0 replies; 2+ messages in thread
From: Kiryl Shutsemau @ 2026-08-31 9:00 UTC (permalink / raw)
To: Sarthak Sharma
Cc: Andrew Morton, David Hildenbrand, Jason Gunthorpe, John Hubbard,
Peter Xu, linux-mm, linux-kernel
On Mon, Aug 31, 2026 at 12:18:08PM +0530, Sarthak Sharma wrote:
> __gup_test_ioctl() advances addr to the end of the current batch before
> checking if GUP pinned the entire requested batch. If GUP pins more than
> 0 pages but less that the requested batch size, addr still advances by
s/that/than/
> the requested batch size.
>
> The next iteration detects the partial pinning and breaks out of the loop.
> Again gup->size is calculated using addr - gup->addr, so it also includes
> the unpinned pages of the requested batch.
>
> Calculate gup->size using the actual number of pages pinned multiplied
> by PAGE_SIZE.
>
> Fixes: 64c349f4ae78 ("mm: add infrastructure for get_user_pages_fast() benchmarking")
> Signed-off-by: Sarthak Sharma <sarthak.sharma@arm.com>
Reviewed-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-31 9:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 6:48 [PATCH] mm/gup_test: report actual pinned bytes Sarthak Sharma
2026-08-31 9:00 ` Kiryl Shutsemau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®