[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220512163902.5e128f6dd5dd6e44afa53259@linux-foundation.org>
Date: Thu, 12 May 2022 16:39:02 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Yang Shi <shy828301@...il.com>
Cc: willy@...radead.org, songmuchun@...edance.com, 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, 12 May 2022 10:45:51 -0700 Yang Shi <shy828301@...il.com> 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.
>
> ...
>
> --- a/mm/page_vma_mapped.c
> +++ b/mm/page_vma_mapped.c
> @@ -237,13 +237,14 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> spin_unlock(pvmw->ptl);
> pvmw->ptl = NULL;
> } else if (!pmd_present(pmde)) {
> + unsigned long haddr = pvmw->address & HPAGE_PMD_MASK;
This hits
#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
when CONFIG_TRANSPARENT_HUGEPAGE=n (x86_64 allnoconfig).
Powered by blists - more mailing lists