Re: [PATCH v4 6/7] mm/khugepaged: unmap pte before releasing vma write lock
"Lorenzo Stoakes (ARM)" <[email protected]>
| Newsgroups | org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <aoLyqr_LZ42Kv6GM@lucifer> |
On Tue, Aug 11, 2026 at 06:48:38AM -0600, Nico Pache (Red Hat) wrote: > We are currently dropping the anon_vma write lock before unmapping the > PTE. Although this is safe, due to us still holding the mmap_write_lock, > its safer and less confusing to switch the order of these two operations. > > Suggested-by: David Hildenbrand <[email protected]> > Acked-by: David Hildenbrand (Arm) <[email protected]> > Signed-off-by: Nico Pache (Red Hat) <[email protected]> LGTM so: Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]> > --- > mm/khugepaged.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/khugepaged.c b/mm/khugepaged.c > index b7372aba4417..0ba637df9c48 100644 > --- a/mm/khugepaged.c > +++ b/mm/khugepaged.c > @@ -1546,10 +1546,10 @@ static enum scan_result collapse_huge_page(struct mm_struct *mm, unsigned long s > > result = SCAN_SUCCEED; > out_up_write: > - if (anon_vma_locked) > - anon_vma_unlock_write(vma->anon_vma); > if (pte) > pte_unmap(pte); > + if (anon_vma_locked) > + anon_vma_unlock_write(vma->anon_vma); > mmap_write_unlock(mm); > out_nolock: > if (folio) > > -- > 2.55.0 > -- Cheers, Lorenzo