From: Andrew Morton <akpm@linux-foundation.org>
To: Yang Shi <shy828301@gmail.com>
Cc: David Hildenbrand <david@redhat.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Hugh Dickins <hughd@google.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux MM <linux-mm@kvack.org>,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH] mm: thp: don't have to lock page anymore when splitting PMD
Date: Mon, 7 Mar 2022 16:50:15 -0800 [thread overview]
Message-ID: <20220307165015.77fbcbe9e1fa2fe15f3eb239@linux-foundation.org> (raw)
In-Reply-To: <CAHbLzkqY69nFniK+ckQaeu117Q+OqZ2hvFEdVbZaW2C_zAzDbg@mail.gmail.com>
On Mon, 7 Mar 2022 16:03:12 -0800 Yang Shi <shy828301@gmail.com> wrote:
> On Mon, Mar 7, 2022 at 3:43 PM Andrew Morton <akpm@linux-foundation.org> wrote:
> > @@ -2133,8 +2133,6 @@ void __split_huge_pmd(struct vm_area_str
> > {
> > spinlock_t *ptl;
> > struct mmu_notifier_range range;
> > - bool do_unlock_folio = false;
> > - pmd_t _pmd;
> >
> > mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm,
> > address & HPAGE_PMD_MASK,
> > @@ -2153,42 +2151,14 @@ void __split_huge_pmd(struct vm_area_str
> > goto out;
> > }
> >
> > -repeat:
> > if (pmd_trans_huge(*pmd)) {
> > - if (!folio) {
> > + if (!folio)
> > folio = page_folio(pmd_page(*pmd));
>
> We could remove the "if (pmd_trans_huge(*pmd))" section since folio is
> actually not used afterward at all.
>
> ...
>
>
> With the above if removed, this could be changed to:
>
> if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd) ||
> is_pmd_migration_entry(*pmd))
> __split_huge_pmd_locked(vma, pmd, range.start, freeze);
>
OK, looks sane. Can someone please test all this?
--- a/mm/huge_memory.c~mm-huge_memory-remove-stale-locking-logic-from-__split_huge_pmd-fix
+++ a/mm/huge_memory.c
@@ -2151,12 +2151,10 @@ void __split_huge_pmd(struct vm_area_str
goto out;
}
- if (pmd_trans_huge(*pmd)) {
- if (!folio)
- folio = page_folio(pmd_page(*pmd));
- } else if (!(pmd_devmap(*pmd) || is_pmd_migration_entry(*pmd)))
- goto out;
- __split_huge_pmd_locked(vma, pmd, range.start, freeze);
+ if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd) ||
+ is_pmd_migration_entry(*pmd)))
+ __split_huge_pmd_locked(vma, pmd, range.start, freeze);
+
out:
spin_unlock(ptl);
/*
_
next prev parent reply other threads:[~2022-03-08 0:50 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 22:20 Yang Shi
2022-03-04 2:25 ` Miaohe Lin
2022-03-04 3:12 ` Yang Shi
2022-03-04 5:06 ` David Hildenbrand
2022-03-04 18:30 ` Yang Shi
2022-03-04 18:50 ` David Hildenbrand
2022-03-04 19:01 ` Yang Shi
2022-03-07 2:07 ` Andrew Morton
2022-03-07 8:24 ` David Hildenbrand
2022-03-07 23:43 ` Andrew Morton
2022-03-08 0:03 ` Yang Shi
2022-03-08 0:50 ` Andrew Morton [this message]
2022-03-08 0:59 ` Yang Shi
2022-03-08 2:36 ` Hugh Dickins
2022-03-08 3:12 ` Yang Shi
2022-03-08 8:53 ` David Hildenbrand
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=20220307165015.77fbcbe9e1fa2fe15f3eb239@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=aarcange@redhat.com \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox