aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/paging_tmpl.h
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2010-05-26 04:49:59 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:35:52 -0400
commit2032a93d66fa282ba0f2ea9152eeff9511fa9a96 (patch)
treef0bbd50c3f237fa93c87207dc29602cbdcf9ad63 /arch/x86/kvm/paging_tmpl.h
parentc8174f7b35b3018c4c7b3237ed1c792e454fd5c3 (diff)
KVM: MMU: Don't allocate gfns page for direct mmu pages
When sp->role.direct is set, sp->gfns does not contain any essential information, leaf sptes reachable from this sp are for a continuous guest physical memory range (a linear range). So sp->gfns[i] (if it was set) equals to sp->gfn + i. (PT_PAGE_TABLE_LEVEL) Obviously, it is not essential information, we can calculate it when need. It means we don't need sp->gfns when sp->role.direct=1, Thus we can save one page usage for every kvm_mmu_page. Note: Access to sp->gfns must be wrapped by kvm_mmu_page_get_gfn() or kvm_mmu_page_set_gfn(). It is only exposed in FNAME(sync_page). Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/paging_tmpl.h')
-rw-r--r--arch/x86/kvm/paging_tmpl.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 167f53357eef..2ee7060a80a5 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -582,6 +582,9 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
582 582
583 offset = nr_present = 0; 583 offset = nr_present = 0;
584 584
585 /* direct kvm_mmu_page can not be unsync. */
586 BUG_ON(sp->role.direct);
587
585 if (PTTYPE == 32) 588 if (PTTYPE == 32)
586 offset = sp->role.quadrant << PT64_LEVEL_BITS; 589 offset = sp->role.quadrant << PT64_LEVEL_BITS;
587 590