[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210604154728.itpbqhwub5squt2u@box.shutemov.name>
Date: Fri, 4 Jun 2021 18:47:28 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Hugh Dickins <hughd@...gle.com>
Cc: Peter Xu <peterx@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Yang Shi <shy828301@...il.com>,
Wang Yugui <wangyugui@...-tech.com>,
Matthew Wilcox <willy@...radead.org>,
Naoya Horiguchi <naoya.horiguchi@....com>,
Alistair Popple <apopple@...dia.com>,
Ralph Campbell <rcampbell@...dia.com>, Zi Yan <ziy@...dia.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Minchan Kim <minchan@...nel.org>, Jue Wang <juew@...gle.com>,
Jan Kara <jack@...e.cz>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/7] mm/thp: try_to_unmap() use TTU_SYNC for safe
DEBUG_VM splitting
On Thu, Jun 03, 2021 at 07:54:11PM -0700, Hugh Dickins wrote:
> On Thu, 3 Jun 2021, Peter Xu wrote:
> > On Tue, Jun 01, 2021 at 02:07:53PM -0700, Hugh Dickins wrote:
> > > diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c
> > > index 2cf01d933f13..b45d22738b45 100644
> > > --- a/mm/page_vma_mapped.c
> > > +++ b/mm/page_vma_mapped.c
> > > @@ -212,6 +212,14 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)
> > > pvmw->ptl = NULL;
> > > }
> > > } else if (!pmd_present(pmde)) {
> > > + /*
> > > + * If PVMW_SYNC, take and drop THP pmd lock so that we
> > > + * cannot return prematurely, while zap_huge_pmd() has
> > > + * cleared *pmd but not decremented compound_mapcount().
> > > + */
> > > + if ((pvmw->flags & PVMW_SYNC) &&
> > > + PageTransCompound(pvmw->page))
> > > + spin_unlock(pmd_lock(mm, pvmw->pmd));
> > > return false;
> > > }
> > > if (!map_pte(pvmw))
> >
> > Sorry if I missed something important, but I'm totally confused on how this
> > unlock is pairing with another lock()..
>
> I imagine you're reading that as spin_unlock(pmd_lockptr(blah));
> no, the lock is right there, inside spin_unlock(pmd_lock(blah)).
Oh.. It made me scratch head too. Could you rewrite it in a more readable
way?
--
Kirill A. Shutemov
Powered by blists - more mailing lists