Re: [PATCH] mm/gup_test: report actual pinned bytes

From: Kiryl Shutsemau

Date: Mon Aug 31 2026 - 05:05:59 EST


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@xxxxxxx>

Reviewed-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>

--
Kiryl Shutsemau / Kirill A. Shutemov