Re: [RFC PATCH v2 24/47] hugetlb: update page_vma_mapped to do high-granularity walks

From: Peter Xu
Date: Thu Dec 15 2022 - 13:46:26 EST


Hi, James,

On Thu, Dec 15, 2022 at 12:49:18PM -0500, James Houghton wrote:
> > @@ -166,19 +167,57 @@ bool page_vma_mapped_walk(struct page_vma_mapped_walk *pvmw)

[...]

> I realize that I can't do this -- we're already holding the
> i_mmap_rwsem, and we have to take the VMA lock first. It seems like
> we're always holding it for writing in this case, so if I make
> hugetlb_collapse taking the i_mmap_rwsem for reading, this will be
> safe.
>
> Peter, you looked at this recently [1] -- do you know if we're always
> holding i_mmap_rwsem *for writing* here?
>
> [1] https://lore.kernel.org/linux-mm/20221209170100.973970-10-peterx@xxxxxxxxxx/

I think so, an analysis is in previous v2 in one of my reply to John:

https://lore.kernel.org/all/Y5JjTPTxCWSklCan@x1n/

No hurt to double check, though.

--
Peter Xu