From b490c667491ef7c8442a7a41e6a8589787019f84 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 17 Oct 2024 15:22:06 +0100 Subject: [PATCH] ANDROID: KVM: arm64: Don't skip accounting when memcache top-up fails If topup_hyp_memcache() fails mid-way through a memcache top-up, we should still account for the pages that were successfully added. Don't skip accounting when topup_hyp_memcache() fails. Bug: 373813803 Signed-off-by: Will Deacon Change-Id: I2ffcfbe45452600994f5b69b73ea2bd00d64aeae --- arch/arm64/kvm/mmu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 0f3817fc7ecc..e056e664f1ea 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -981,9 +981,7 @@ int topup_hyp_memcache(struct kvm_vcpu *vcpu) err = __topup_hyp_memcache(mc, kvm_mmu_cache_min_pages(vcpu->kvm), hyp_mc_alloc_fn, kvm_host_pa, NULL); - if (!err) - account_hyp_memcache(mc, prev_nr_pages, vcpu->kvm); - + account_hyp_memcache(mc, prev_nr_pages, vcpu->kvm); return err; }