[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [IA64] Speedup ptc.e emulation



# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1184528447 21600
# Node ID 834ac63f4894443dd825ef0d9ef478fb48416d43
# Parent  2796311c6a5537cff38bba20b74a1e64a1d9e909
[IA64] Speedup ptc.e emulation

This patch makes ptc.e emulation faster.
It defers the initialization of collision chain area of VHPT.
Also removes an unused field from struct thash_cb.

Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 xen/arch/ia64/vmx/vtlb.c    |   49 +++++++++++++++++---------------------------
 xen/include/asm-ia64/vmmu.h |    2 -
 2 files changed, 20 insertions(+), 31 deletions(-)

diff -r 2796311c6a55 -r 834ac63f4894 xen/arch/ia64/vmx/vtlb.c
--- a/xen/arch/ia64/vmx/vtlb.c  Sun Jul 15 13:32:56 2007 -0600
+++ b/xen/arch/ia64/vmx/vtlb.c  Sun Jul 15 13:40:47 2007 -0600
@@ -36,19 +36,10 @@
 
 thash_data_t *__alloc_chain(thash_cb_t *);
 
-static void cch_mem_init(thash_cb_t *hcb)
-{
-    int num;
-    thash_data_t *p;
-
-    hcb->cch_freelist = p = hcb->cch_buf;
-    num = (hcb->cch_sz/sizeof(thash_data_t))-1;
-    do{
-        p->next =p+1;
-        p++;
-        num--;
-    }while(num);
-    p->next = NULL;
+static inline void cch_mem_init(thash_cb_t *hcb)
+{
+    hcb->cch_free_idx = 0;
+    hcb->cch_freelist = NULL;
 }
 
 static thash_data_t *cch_alloc(thash_cb_t *hcb)
@@ -56,8 +47,16 @@ static thash_data_t *cch_alloc(thash_cb_
     thash_data_t *p;
     if ( (p = hcb->cch_freelist) != NULL ) {
         hcb->cch_freelist = p->next;
-    }
-    return p;
+        return p;
+    }
+    if (hcb->cch_free_idx < hcb->cch_sz/sizeof(thash_data_t)) {
+        p = &((thash_data_t *)hcb->cch_buf)[hcb->cch_free_idx++];
+        p->page_flags = 0;
+        p->itir = 0;
+        p->next = NULL;
+        return p;
+    }
+    return NULL;
 }
 
 /*
@@ -668,13 +667,12 @@ void thash_init(thash_cb_t *hcb, u64 sz)
 void thash_init(thash_cb_t *hcb, u64 sz)
 {
     int num;
-    thash_data_t *head, *p;
+    thash_data_t *head;
 
     hcb->pta.val = (unsigned long)hcb->hash;
     hcb->pta.vf = 1;
     hcb->pta.ve = 1;
     hcb->pta.size = sz;
-    hcb->cch_rec_head = hcb->hash;
     
     head=hcb->hash;
     num = (hcb->hash_sz/sizeof(thash_data_t));
@@ -686,16 +684,7 @@ void thash_init(thash_cb_t *hcb, u64 sz)
         head++;
         num--;
     }while(num);
-    
-    hcb->cch_freelist = p = hcb->cch_buf;
-    num = hcb->cch_sz / sizeof(thash_data_t);
-    do{
-        p->page_flags = 0;
-        p->itir = 0;
-        p->next =p+1;
-        p++;
-        num--;
-    }while(num);
-
-    (p - 1)->next = NULL;
-}
+
+    hcb->cch_free_idx = 0;
+    hcb->cch_freelist = NULL;
+}
diff -r 2796311c6a55 -r 834ac63f4894 xen/include/asm-ia64/vmmu.h
--- a/xen/include/asm-ia64/vmmu.h       Sun Jul 15 13:32:56 2007 -0600
+++ b/xen/include/asm-ia64/vmmu.h       Sun Jul 15 13:40:47 2007 -0600
@@ -196,8 +196,8 @@ typedef struct thash_cb {
     u64     hash_sz;        // size of above data.
     void    *cch_buf;       // base address of collision chain.
     u64     cch_sz;         // size of above data.
+    u64     cch_free_idx;   // index of free entry.
     thash_data_t *cch_freelist;
-    thash_data_t *cch_rec_head;  // cch recycle header
     PTA     pta;
 } thash_cb_t;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.