Re: [PATCH] mm/hugetlb: Move vmf_anon_prepare upfront in hugetlb_wp

From: Oscar Salvador
Date: Mon May 27 2024 - 09:54:57 EST


On Mon, May 27, 2024 at 03:17:01PM +0200, David Hildenbrand wrote:
> gup_must_unshare() without a VMA is only used for GUP-fast. Before
> triggering a page fault we always fallback to GUP-slow first, where we have
> a VMA.

I see, thanks for explaining!

> IMHO we better not make assumptions that hugetlb_wp() will always already
> have an anon VMA.

Fine by me, I just wanted to have the picture more clear, because I could not
see how we could end up in such situation, but better be safe and than sorry.

@Andrew: This fix is to avoid an issue like [1], but for hugetlb_wp().

[1] https://lore.kernel.org/linux-mm/000000000000daf1e10615e64dcb@xxxxxxxxxx/T/


--
Oscar Salvador
SUSE Labs