Re: [PATCH v2 3/6] mm: page_vma_mapped: support checking if a pfn is mapped into a vma

From: Matthew Wilcox
Date: Wed Feb 02 2022 - 13:28:49 EST


On Wed, Feb 02, 2022 at 10:33:04PM +0800, Muchun Song wrote:
> page_vma_mapped_walk() is supposed to check if a page is mapped into a vma.
> However, not all page frames (e.g. PFN_DEV) have a associated struct page
> with it. There is going to be some duplicate codes similar with this function
> if someone want to check if a pfn (without a struct page) is mapped into a
> vma. So add support for checking if a pfn is mapped into a vma. In the next
> patch, the dax will use this new feature.

I'm coming to more or less the same solution for fixing the bug in
page_mapped_in_vma(). If you call it with a head page, it will look
for any page in the THP instead of the precise page. I think we can do
a fairly significant simplification though, so I'm going to go off
and work on that next ...