Re: [PATCH RFC v3 2/4] KVM: guest_memfd: Set release always on guest_memfd mappings

From: Jan Kara

Date: Mon Mar 09 2026 - 07:43:15 EST


On Mon 09-03-26 09:53:53, Ackerley Tng wrote:
> Set release always on guest_memfd mappings to enable the use of
> .invalidate_folio, which performs inode accounting for guest_memfd.
>
> Signed-off-by: Ackerley Tng <ackerleytng@xxxxxxxxxx>

I'd fold this into the previous patch because that makes sense only with
this patch in place. Otherwise feel free to add:

Reviewed-by: Jan Kara <jack@xxxxxxx>

for the first two patches.

Honza

> ---
> virt/kvm/guest_memfd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c
> index 77219551056a7..8246b9fbcf832 100644
> --- a/virt/kvm/guest_memfd.c
> +++ b/virt/kvm/guest_memfd.c
> @@ -607,6 +607,7 @@ static int __kvm_gmem_create(struct kvm *kvm, loff_t size, u64 flags)
> mapping_set_inaccessible(inode->i_mapping);
> /* Unmovable mappings are supposed to be marked unevictable as well. */
> WARN_ON_ONCE(!mapping_unevictable(inode->i_mapping));
> + mapping_set_release_always(inode->i_mapping);
>
> GMEM_I(inode)->flags = flags;
>
>
> --
> 2.53.0.473.g4a7958ca14-goog
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR