[PATCH v6 01/11] filemap: Pass address_space mapping to ->free_folio()
Pedro Falcato
pfalcato at suse.de
Fri Sep 12 03:48:15 PDT 2025
On Fri, Sep 12, 2025 at 09:17:31AM +0000, Roy, Patrick wrote:
> From: Elliot Berman <quic_eberman at quicinc.com>
>
> When guest_memfd removes memory from the host kernel's direct map,
> direct map entries must be restored before the memory is freed again. To
> do so, ->free_folio() needs to know whether a gmem folio was direct map
> removed in the first place though. While possible to keep track of this
> information on each individual folio (e.g. via page flags), direct map
> removal is an all-or-nothing property of the entire guest_memfd, so it
> is less error prone to just check the flag stored in the gmem inode's
> private data. However, by the time ->free_folio() is called,
> folio->mapping might be cleared. To still allow access to the address
> space from which the folio was just removed, pass it in as an additional
> argument to ->free_folio, as the mapping is well-known to all callers.
>
> Link: https://lore.kernel.org/all/15f665b4-2d33-41ca-ac50-fafe24ade32f@redhat.com/
> Suggested-by: David Hildenbrand <david at redhat.com>
> Acked-by: David Hildenbrand <david at redhat.com>
> Signed-off-by: Elliot Berman <quic_eberman at quicinc.com>
> [patrick: rewrite shortlog for new usecase]
> Signed-off-by: Patrick Roy <roypat at amazon.co.uk>
Reviewed-by: Pedro Falcato <pfalcato at suse.de>
--
Pedro
More information about the linux-riscv
mailing list