# HG changeset patch
# User awilliam@xxxxxxxxxxx
# Node ID de50245ad4e39364c265eed7cbd15d62e5b634f5
# Parent fd79ca20d91af66f4ebd711207a32a00050e37b2
[IA64] micro optimize __domain_flush_vtlb_track_entry.
try to use local purge instead of global purge when possible.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
---
xen/arch/ia64/xen/vhpt.c | 25 ++++++++++++++++++++++---
xen/include/asm-ia64/perfc_defn.h | 2 ++
2 files changed, 24 insertions(+), 3 deletions(-)
diff -r fd79ca20d91a -r de50245ad4e3 xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c Tue Oct 17 14:16:19 2006 -0600
+++ b/xen/arch/ia64/xen/vhpt.c Tue Oct 17 14:22:08 2006 -0600
@@ -381,7 +381,8 @@ __domain_flush_vtlb_track_entry(struct d
struct vcpu* v;
int cpu;
int vcpu;
-
+ int local_purge = 1;
+
BUG_ON((vaddr >> VRN_SHIFT) != VRN7);
/*
* heuristic:
@@ -414,17 +415,35 @@ __domain_flush_vtlb_track_entry(struct d
/* Invalidate VHPT entries. */
vcpu_flush_vhpt_range(v, vaddr, PAGE_SIZE);
+
+ /*
+ * current->processor == v->processor
+ * is racy. we may see old v->processor and
+ * a new physical processor of v might see old
+ * vhpt entry and insert tlb.
+ */
+ if (v != current)
+ local_purge = 0;
}
} else {
for_each_cpu_mask(cpu, entry->pcpu_dirty_mask) {
/* Invalidate VHPT entries. */
cpu_flush_vhpt_range(cpu, vaddr, PAGE_SIZE);
+
+ if (d->vcpu[cpu] != current)
+ local_purge = 0;
}
}
- /* ptc.ga has release semantics. */
/* ptc.ga */
- ia64_global_tlb_purge(vaddr, vaddr + PAGE_SIZE, PAGE_SHIFT);
+ if (local_purge) {
+ ia64_ptcl(vaddr, PAGE_SHIFT << 2);
+ perfc_incrc(domain_flush_vtlb_local);
+ } else {
+ /* ptc.ga has release semantics. */
+ ia64_global_tlb_purge(vaddr, vaddr + PAGE_SIZE, PAGE_SHIFT);
+ perfc_incrc(domain_flush_vtlb_global);
+ }
if (swap_rr0) {
vcpu_set_rr(current, 0, old_rid);
diff -r fd79ca20d91a -r de50245ad4e3 xen/include/asm-ia64/perfc_defn.h
--- a/xen/include/asm-ia64/perfc_defn.h Tue Oct 17 14:16:19 2006 -0600
+++ b/xen/include/asm-ia64/perfc_defn.h Tue Oct 17 14:22:08 2006 -0600
@@ -115,6 +115,8 @@ PERFCOUNTER_CPU(domain_flush_vtlb_all,
PERFCOUNTER_CPU(domain_flush_vtlb_all, "domain_flush_vtlb_all")
PERFCOUNTER_CPU(vcpu_flush_tlb_vhpt_range, "vcpu_flush_tlb_vhpt_range")
PERFCOUNTER_CPU(domain_flush_vtlb_track_entry,
"domain_flush_vtlb_track_entry")
+PERFCOUNTER_CPU(domain_flush_vtlb_local, "domain_flush_vtlb_local")
+PERFCOUNTER_CPU(domain_flush_vtlb_global, "domain_flush_vtlb_global")
PERFCOUNTER_CPU(domain_flush_vtlb_range, "domain_flush_vtlb_range")
// domain.c
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|