Re: [PATCH v2 1/4] mm/vmalloc: fix vmalloc_to_page for huge vmap mappings
From: Matthew Wilcox
Date: Mon Apr 13 2020 - 09:34:57 EST
On Mon, Apr 13, 2020 at 10:53:00PM +1000, Nicholas Piggin wrote:
> vmalloc_to_page returns NULL for addresses mapped by larger pages[*].
> Whether or not a vmap is huge depends on the architecture details,
> alignments, boot options, etc., which the caller can not be expected
> to know. Therefore HUGE_VMAP is a regression for vmalloc_to_page.
>
> This change teaches vmalloc_to_page about larger pages, and returns
> the struct page that corresponds to the offset within the large page.
> This makes the API agnostic to mapping implementation details.
I'm trying to get us away from returning tail pages from various
functions. How much of a pain would it be to return the head page
instead of the tail page? Obviously the implementation gets simpler,
but can the callers cope? I've been focusing on the page cache, so I
haven't been looking at the vmalloc side of things at all.