Re: [PATCH v2] mm/gup_test: report actual pinned bytes
From: Andrew Morton
Date: Mon Aug 31 2026 - 20:12:11 EST
On Mon, 31 Aug 2026 15:43:04 +0530 Sarthak Sharma <sarthak.sharma@xxxxxxx> 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 than 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.
Thanks. Sashiko might have found a somewhat-related overflow on
32-bit. Maybe fix that while we're in there?
https://sashiko.dev/#/patchset/20260831101304.162867-1-sarthak.sharma@xxxxxxx