From: Andrew Morton <akpm@linux-foundation.org>
To: "Zach O'Keefe" <zokeefe@google.com>
Cc: Yang Shi <shy828301@gmail.com>,
vbabka@suse.cz, kirill.shutemov@linux.intel.com,
willy@infradead.org, linmiaohe@huawei.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [v5 PATCH 4/7] mm: thp: kill transparent_hugepage_active()
Date: Tue, 21 Jun 2022 17:54:12 -0700 [thread overview]
Message-ID: <20220621175412.02d90df5f381de0cd676adf8@linux-foundation.org> (raw)
In-Reply-To: <YrIU2iP0H5LQbV7R@google.com>
On Tue, 21 Jun 2022 11:58:34 -0700 "Zach O'Keefe" <zokeefe@google.com> wrote:
> > -bool transparent_hugepage_active(struct vm_area_struct *vma)
> > +bool hugepage_vma_check(struct vm_area_struct *vma,
> > + unsigned long vm_flags,
> > + bool smaps)
> > {
> > - /* The addr is used to check if the vma size fits */
> > - unsigned long addr = (vma->vm_end & HPAGE_PMD_MASK) - HPAGE_PMD_SIZE;
> > + if (!transhuge_vma_enabled(vma, vm_flags))
> > + return false;
> > +
>
> During testing my work on top this patch, I found a small bug here.
>
> Namely, transhuge_vma_enabled() will check vma->vm_mm->flags (to see if
> MMF_DISABLE_THP is set); however, for vDSO vmas, vma->vm_mm is NULL.
>
> Previously, transparent_hugepage_active() in smaps path would check
> transhuge_vma_suitable() before checking these flags, which would fail for vDSO
> vma since we'd take the !vma_is_anonymous() branch and find the vma (most
> likely) wasn't suitably aligned (by chance ?).
>
> Anyways, I think we need to check vma->vm_mm.
Like this?
--- a/mm/huge_memory.c~mm-thp-kill-transparent_hugepage_active-fix
+++ a/mm/huge_memory.c
@@ -73,6 +73,9 @@ bool hugepage_vma_check(struct vm_area_s
unsigned long vm_flags,
bool smaps)
{
+ if (!vma->vm_mm)
+ return false;
+
if (!transhuge_vma_enabled(vma, vm_flags))
return false;
_
next prev parent reply other threads:[~2022-06-22 0:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 17:48 [mm-unstable v5 PATCH 0/7] Cleanup transhuge_xxx helpers Yang Shi
2022-06-16 17:48 ` [v5 PATCH 1/7] mm: khugepaged: check THP flag in hugepage_vma_check() Yang Shi
2022-06-16 17:48 ` [v5 PATCH 2/7] mm: thp: consolidate vma size check to transhuge_vma_suitable Yang Shi
2022-06-16 17:48 ` [v5 PATCH 3/7] mm: khugepaged: better comments for anon vma check in hugepage_vma_revalidate Yang Shi
2022-06-16 17:48 ` [v5 PATCH 4/7] mm: thp: kill transparent_hugepage_active() Yang Shi
2022-06-21 18:58 ` Zach O'Keefe
2022-06-22 0:54 ` Andrew Morton [this message]
2022-06-22 17:52 ` Zach O'Keefe
2022-06-16 17:48 ` [v5 PATCH 5/7] mm: thp: kill __transhuge_page_enabled() Yang Shi
2022-06-16 17:48 ` [v5 PATCH 6/7] mm: khugepaged: reorg some khugepaged helpers Yang Shi
2022-06-16 17:48 ` [v5 PATCH 7/7] doc: proc: fix the description to THPeligible Yang Shi
2022-06-16 23:08 ` [mm-unstable v5 PATCH 0/7] Cleanup transhuge_xxx helpers Zach O'Keefe
2022-06-17 17:54 ` Yang Shi
2022-06-21 21:07 ` Mike Kravetz
2022-06-21 22:43 ` Zach O'Keefe
2022-07-03 23:14 ` Andrew Morton
2022-07-05 19:45 ` Yang Shi
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=20220621175412.02d90df5f381de0cd676adf8@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=zokeefe@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox