Commit 68a99f6d authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] KVM: Simplify mmu_alloc_roots()

Small optimization/cleanup:

    page == page_header(page->page_hpa)
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d21225ee
...@@ -820,9 +820,9 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) ...@@ -820,9 +820,9 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
hpa_t root = vcpu->mmu.root_hpa; hpa_t root = vcpu->mmu.root_hpa;
ASSERT(!VALID_PAGE(root)); ASSERT(!VALID_PAGE(root));
root = kvm_mmu_get_page(vcpu, root_gfn, 0, page = kvm_mmu_get_page(vcpu, root_gfn, 0,
PT64_ROOT_LEVEL, 0, NULL)->page_hpa; PT64_ROOT_LEVEL, 0, NULL);
page = page_header(root); root = page->page_hpa;
++page->root_count; ++page->root_count;
vcpu->mmu.root_hpa = root; vcpu->mmu.root_hpa = root;
return; return;
...@@ -836,10 +836,10 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu) ...@@ -836,10 +836,10 @@ static void mmu_alloc_roots(struct kvm_vcpu *vcpu)
root_gfn = vcpu->pdptrs[i] >> PAGE_SHIFT; root_gfn = vcpu->pdptrs[i] >> PAGE_SHIFT;
else if (vcpu->mmu.root_level == 0) else if (vcpu->mmu.root_level == 0)
root_gfn = 0; root_gfn = 0;
root = kvm_mmu_get_page(vcpu, root_gfn, i << 30, page = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
PT32_ROOT_LEVEL, !is_paging(vcpu), PT32_ROOT_LEVEL, !is_paging(vcpu),
NULL)->page_hpa; NULL);
page = page_header(root); root = page->page_hpa;
++page->root_count; ++page->root_count;
vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK; vcpu->mmu.pae_root[i] = root | PT_PRESENT_MASK;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment