From: Yang Shi <shy828301@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
songmuchun@bytedance.com, willy@infradead.org
Subject: Re: [PATCH 2/2] mm: pvmw: check possible huge PMD map by transhuge_vma_suitable()
Date: Thu, 12 May 2022 17:39:15 -0700 [thread overview]
Message-ID: <CAHbLzkrR9Y2e2uf5HjT-55BjdAMHscvbLx5Cv1WvP7iCX-=AgQ@mail.gmail.com> (raw)
In-Reply-To: <20220512163902.5e128f6dd5dd6e44afa53259@linux-foundation.org>
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
Andrew Morton <akpm@linux-foundation.org>于2022年5月12日 周四下午4:39写道:
> On Thu, 12 May 2022 10:45:51 -0700 Yang Shi <shy828301@gmail.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).
Thanks for catching this. I think the best way is to round the address in
transhuge_vma_suitable() which is protected by the config.
Will prepare v2 soon.
>
>
[-- Attachment #2: Type: text/html, Size: 2288 bytes --]
next prev parent reply other threads:[~2022-05-13 0:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-12 17:45 [PATCH 1/2] mm: rmap: use the correct parameter name for DEFINE_PAGE_VMA_WALK Yang Shi
2022-05-12 17:45 ` [PATCH 2/2] mm: pvmw: check possible huge PMD map by transhuge_vma_suitable() Yang Shi
2022-05-12 23:39 ` Andrew Morton
2022-05-13 0:39 ` Yang Shi [this message]
2022-05-13 1:41 ` kernel test robot
2022-05-13 3:30 ` Matthew Wilcox
2022-05-13 3:51 ` Yang Shi
2022-05-13 2:16 ` [PATCH 1/2] mm: rmap: use the correct parameter name for DEFINE_PAGE_VMA_WALK Matthew Wilcox
2022-05-13 2:42 ` Muchun Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHbLzkrR9Y2e2uf5HjT-55BjdAMHscvbLx5Cv1WvP7iCX-=AgQ@mail.gmail.com' \
--to=shy828301@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=songmuchun@bytedance.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.