lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220307165015.77fbcbe9e1fa2fe15f3eb239@linux-foundation.org>
Date:   Mon, 7 Mar 2022 16:50:15 -0800
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     Yang Shi <shy828301@...il.com>
Cc:     David Hildenbrand <david@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Hugh Dickins <hughd@...gle.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux MM <linux-mm@...ck.org>,
        Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH] mm: thp: don't have to lock page anymore when splitting
 PMD

On Mon, 7 Mar 2022 16:03:12 -0800 Yang Shi <shy828301@...il.com> wrote:

> On Mon, Mar 7, 2022 at 3:43 PM Andrew Morton <akpm@...ux-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);
 	/*
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ