[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yn3Q7KIb3FcAPW9j@casper.infradead.org>
Date: Fri, 13 May 2022 04:30:52 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Yang Shi <shy828301@...il.com>
Cc: songmuchun@...edance.com, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] mm: pvmw: check possible huge PMD map by
transhuge_vma_suitable()
On Thu, May 12, 2022 at 10:45:51AM -0700, Yang Shi wrote:
> IIUC PVMW checks if the vma is possibly huge PMD mapped by
> transparent_hugepage_active() and "pvmw->nr_pages >= HPAGE_PMD_NR".
>
> Actually pvmw->nr_pages is returned by compound_nr() or
> folio_nr_pages(), so the page should be THP as long as "pvmw->nr_pages
> >= HPAGE_PMD_NR". And it is guaranteed THP is allocated for valid VMA
> in the first place. But it may be not PMD mapped if the VMA is file
> VMA and it is not properly aligned. The transhuge_vma_suitable()
> is used to do such check, so replace transparent_hugepage_active() to
> it, which is too heavy and overkilling.
>
> Fixes: 2aff7a4755be ("mm: Convert page_vma_mapped_walk to work on PFNs")
I think Fixes is a bit much. There's no bug being fixed here. This is
just an optimisation. Is it an important optimisation? We could put a
bool into page_vma_mapped_walk() so we only have to ask the page whether
it's PMD-mappable once per walk rather than for each VMA.
Powered by blists - more mailing lists