Re: [PATCH v2 06/28] gup: Fix some contiguous memmap assumptions

From: Christoph Hellwig
Date: Mon Jan 10 2022 - 03:31:07 EST


On Mon, Jan 10, 2022 at 04:23:44AM +0000, Matthew Wilcox (Oracle) wrote:
> Several functions in gup.c assume that a compound page has virtually
> contiguous page structs. This isn't true for SPARSEMEM configs unless
> SPARSEMEM_VMEMMAP is also set. Fix them by using nth_page() instead of
> plain pointer arithmetic.

So is this an actualy bug that need a Fixes tag, or do all architectures
that support THP and sparsemem use SPARSEMEM_VMEMMAP?

> + page = nth_page(head, (addr & (sz-1)) >> PAGE_SHIFT);

Would be nice to fix the indeation for sz - 1 while you're at it.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>