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 <willdeacon@google.com>
Change-Id: I2ffcfbe45452600994f5b69b73ea2bd00d64aeae
This commit is contained in:
Will Deacon
2024-10-17 15:22:06 +01:00
parent 1181501872
commit b490c66749

View File

@@ -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;
}