Re: [PATCH] mm/hugetlb: Fix pgtable lock on pmd sharing

From: Peter Xu
Date: Mon Jun 12 2023 - 17:36:38 EST


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.

--
Peter Xu