Re: [PATCH 4/6] hugetlb: drop vma_hugecache_offset() in favor of linear_page_index()

From: Oscar Salvador

Date: Tue Apr 14 2026 - 05:53:31 EST


On Thu, Apr 09, 2026 at 05:41:55PM -0600, Jane Chu wrote:
> vma_hugecache_offset() converts a hugetlb VMA address into a mapping
> offset in hugepage units. While the helper is small, its name is not very
> clear, and the resulting code is harder to follow than using the common MM
> helper directly.
>
> Use linear_page_index() instead, with an explicit conversion from
> PAGE_SIZE units to hugepage units at each call site, and remove
> vma_hugecache_offset().
>
> This makes the code a bit more direct and avoids a hugetlb-specific helper
> whose behavior is already expressible with existing MM primitives.
>
> Signed-off-by: Jane Chu <jane.chu@xxxxxxxxxx>


Looks good to me, the only thing is the conversion to hugepage units
which may not be very clear to the casual reader, but you already
mentioned that you will add a helper, so all good.



--
Oscar Salvador
SUSE Labs