]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: arm64: account pKVM reclaim against the VM mm
authorBradley Morgan <include@grrlz.net>
Sun, 21 Jun 2026 21:31:55 +0000 (21:31 +0000)
committerMarc Zyngier <maz@kernel.org>
Mon, 22 Jun 2026 09:48:08 +0000 (10:48 +0100)
Protected guest faults charge long term pins to the VM's mm. Teardown
can run later from file release, where current->mm may be unrelated.

Drop the charge from kvm->mm instead.

Fixes: 4e6e03f9eadd ("KVM: arm64: Hook up reclaim hypercall to pkvm_pgtable_stage2_destroy()")
Signed-off-by: Bradley Morgan <include@grrlz.net>
Reviewed-by: Fuad Tabba <fuad.tabba@linux.dev>
Tested-by: Fuad Tabba <fuad.tabba@linux.dev>
Link: https://patch.msgid.link/20260621213155.6019-1-include@grrlz.net
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
arch/arm64/kvm/pkvm.c

index 053e4f733e4bed6e37ef21facbd3076612fcada3..428723b1b0f5c7ed7aa40d31d32a44570469ee59 100644 (file)
@@ -352,7 +352,7 @@ static int __pkvm_pgtable_stage2_reclaim(struct kvm_pgtable *pgt, u64 start, u64
                page = pfn_to_page(mapping->pfn);
                WARN_ON_ONCE(mapping->nr_pages != 1);
                unpin_user_pages_dirty_lock(&page, 1, true);
-               account_locked_vm(current->mm, 1, false);
+               account_locked_vm(kvm->mm, 1, false);
                pkvm_mapping_remove(mapping, &pgt->pkvm_mappings);
                kfree(mapping);
        }