[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4EEB1A95.6030708@linux.vnet.ibm.com>
Date: Fri, 16 Dec 2011 18:16:53 +0800
From: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
To: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
CC: Avi Kivity <avi@...hat.com>, Marcelo Tosatti <mtosatti@...hat.com>,
LKML <linux-kernel@...r.kernel.org>, KVM <kvm@...r.kernel.org>
Subject: [PATCH 5/8] KVM: MMU: optimize walking unsync shadow page
Exactly, unysnc_children is the number of unsync sptes, we can use to
avoid unnecessary spte fetching
Signed-off-by: Xiao Guangrong <xiaoguangrong@...ux.vnet.ibm.com>
---
arch/x86/kvm/mmu.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 9bd2084..16e0642 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1468,12 +1468,15 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
struct kvm_mmu_pages *pvec)
{
u64 *spte;
- int i, ret, nr_unsync_leaf = 0;
+ int i, ret, nr_unsync_leaf = 0, unysnc_children = sp->unsync_children;
for_each_unsync_children(sp, spte, i) {
struct kvm_mmu_page *child;
u64 ent = *spte;
+ if (!unysnc_children--)
+ break;
+
WARN_ON(!is_shadow_present_pte(ent) || is_large_pte(ent));
child = page_header(ent & PT64_BASE_ADDR_MASK);
--
1.7.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists