[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230612214432.GE3704@monkey>
Date: Mon, 12 Jun 2023 14:44:32 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Peter Xu <peterx@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <songmuchun@...edance.com>,
Naoya Horiguchi <naoya.horiguchi@....com>
Subject: Re: [PATCH] mm/hugetlb: Fix pgtable lock on pmd sharing
On 06/12/23 17:35, Peter Xu wrote:
> Hi, Mike!
>
> On Mon, Jun 12, 2023 at 01:44:18PM -0700, Mike Kravetz wrote:
> > Agree with this change. But, it does make one wonder if the pud_clear()
> > in huge_pmd_unshare is safe. Like here, we really should be holding the
> > higher level lock but are holding the PMD lock.
>
> The vma write lock? My memory tells me that you worked on the vma lock and
> one major reason was for that, but maybe I missed something?
>
> I did check again and all call sites should have that lock held, which
> looks fine here. One thing worth mention is pmd unshare should also always
> be gup-fast-safe because it never really releases the pgtable, unlike thp
> collapse.
Yes, Duh!
In the unshare case we KNOW what is mapped (the vma) via the PUD. So,
we certainly am synchronized with that access. I was just trying to
imagine some other situation where we may be walking the page table
without the vma lock held. However, you already took care of those call
sites.
Thanks!
You or Andrew can add,
Reviewed-by: Mike Kravetz <mike.kravetz@...cle.com>
--
Mike Kravetz
Powered by blists - more mailing lists