Re: [PATCH 2/5] userfaultfd, shmem: use a VMA callback to handle UFFDIO_CONTINUE

From: David Hildenbrand (Red Hat)

Date: Mon Nov 24 2025 - 06:03:35 EST


On 11/23/25 11:27, Mike Rapoport wrote:
From: "Mike Rapoport (Microsoft)" <rppt@xxxxxxxxxx>

When userspace resolves a page fault in a shmem VMA with UFFDIO_CONTINUE
it needs to get a folio that already exists in the pagecache backing
that VMA.

Instead of using shmem_get_folio() for that, add a get_pagecache_folio()

get_shared_folio()

Given that the helper now no longer receives a VMA, I assume we can just really call it get_folio() and the "shared" part would be implicit. (from the inode)

method to 'struct vm_operations_struct' that will return a folio if it
exists in the VMA's pagecache at given pgoff.

Implement get_pagecache_folio() method for shmem and slightly refactor
userfaultfd's mfill_atomic() and mfill_atomic_pte_continue() to support
this new API.

Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---

Nothing else jumped at me :)

--
Cheers

David