summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorWei Yongjun2010-04-16 10:21:42 +0200
committerAvi Kivity2010-05-17 11:18:12 +0200
commit77a1a715707d0f60ce0cfbe44070527a0a561f01 (patch)
tree5bc32478e0f0fe77158d975df67471492ef124a6 /arch
parentKVM: Get rid of dead function gva_to_page() (diff)
downloadkernel-qcow2-linux-77a1a715707d0f60ce0cfbe44070527a0a561f01.tar.gz
kernel-qcow2-linux-77a1a715707d0f60ce0cfbe44070527a0a561f01.tar.xz
kernel-qcow2-linux-77a1a715707d0f60ce0cfbe44070527a0a561f01.zip
KVM: MMU: cleanup for function unaccount_shadowed()
Since gfn is not changed in the for loop, we do not need to call gfn_to_memslot_unaliased() under the loop, and it is safe to move it out. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d2a110e870fa..ddfa8658fb6d 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -431,9 +431,9 @@ static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn)
int i;
gfn = unalias_gfn(kvm, gfn);
+ slot = gfn_to_memslot_unaliased(kvm, gfn);
for (i = PT_DIRECTORY_LEVEL;
i < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++i) {
- slot = gfn_to_memslot_unaliased(kvm, gfn);
write_count = slot_largepage_idx(gfn, slot, i);
*write_count -= 1;
WARN_ON(*write_count < 0);