ia64/xen-unstable

changeset 15560:834ac63f4894

[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@jp.fujitsu.com>
author Alex Williamson <alex.williamson@hp.com>
date Sun Jul 15 13:40:47 2007 -0600 (2007-07-15)
parents 2796311c6a55
children e487cc249171
files xen/arch/ia64/vmx/vtlb.c xen/include/asm-ia64/vmmu.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/vtlb.c	Sun Jul 15 13:32:56 2007 -0600
     1.2 +++ b/xen/arch/ia64/vmx/vtlb.c	Sun Jul 15 13:40:47 2007 -0600
     1.3 @@ -36,19 +36,10 @@
     1.4  
     1.5  thash_data_t *__alloc_chain(thash_cb_t *);
     1.6  
     1.7 -static void cch_mem_init(thash_cb_t *hcb)
     1.8 +static inline void cch_mem_init(thash_cb_t *hcb)
     1.9  {
    1.10 -    int num;
    1.11 -    thash_data_t *p;
    1.12 -
    1.13 -    hcb->cch_freelist = p = hcb->cch_buf;
    1.14 -    num = (hcb->cch_sz/sizeof(thash_data_t))-1;
    1.15 -    do{
    1.16 -        p->next =p+1;
    1.17 -        p++;
    1.18 -        num--;
    1.19 -    }while(num);
    1.20 -    p->next = NULL;
    1.21 +    hcb->cch_free_idx = 0;
    1.22 +    hcb->cch_freelist = NULL;
    1.23  }
    1.24  
    1.25  static thash_data_t *cch_alloc(thash_cb_t *hcb)
    1.26 @@ -56,8 +47,16 @@ static thash_data_t *cch_alloc(thash_cb_
    1.27      thash_data_t *p;
    1.28      if ( (p = hcb->cch_freelist) != NULL ) {
    1.29          hcb->cch_freelist = p->next;
    1.30 +        return p;
    1.31      }
    1.32 -    return p;
    1.33 +    if (hcb->cch_free_idx < hcb->cch_sz/sizeof(thash_data_t)) {
    1.34 +        p = &((thash_data_t *)hcb->cch_buf)[hcb->cch_free_idx++];
    1.35 +        p->page_flags = 0;
    1.36 +        p->itir = 0;
    1.37 +        p->next = NULL;
    1.38 +        return p;
    1.39 +    }
    1.40 +    return NULL;
    1.41  }
    1.42  
    1.43  /*
    1.44 @@ -668,13 +667,12 @@ thash_data_t *vtlb_lookup(VCPU *v, u64 v
    1.45  void thash_init(thash_cb_t *hcb, u64 sz)
    1.46  {
    1.47      int num;
    1.48 -    thash_data_t *head, *p;
    1.49 +    thash_data_t *head;
    1.50  
    1.51      hcb->pta.val = (unsigned long)hcb->hash;
    1.52      hcb->pta.vf = 1;
    1.53      hcb->pta.ve = 1;
    1.54      hcb->pta.size = sz;
    1.55 -    hcb->cch_rec_head = hcb->hash;
    1.56      
    1.57      head=hcb->hash;
    1.58      num = (hcb->hash_sz/sizeof(thash_data_t));
    1.59 @@ -686,16 +684,7 @@ void thash_init(thash_cb_t *hcb, u64 sz)
    1.60          head++;
    1.61          num--;
    1.62      }while(num);
    1.63 -    
    1.64 -    hcb->cch_freelist = p = hcb->cch_buf;
    1.65 -    num = hcb->cch_sz / sizeof(thash_data_t);
    1.66 -    do{
    1.67 -        p->page_flags = 0;
    1.68 -        p->itir = 0;
    1.69 -        p->next =p+1;
    1.70 -        p++;
    1.71 -        num--;
    1.72 -    }while(num);
    1.73  
    1.74 -    (p - 1)->next = NULL;
    1.75 +    hcb->cch_free_idx = 0;
    1.76 +    hcb->cch_freelist = NULL;
    1.77  }
     2.1 --- a/xen/include/asm-ia64/vmmu.h	Sun Jul 15 13:32:56 2007 -0600
     2.2 +++ b/xen/include/asm-ia64/vmmu.h	Sun Jul 15 13:40:47 2007 -0600
     2.3 @@ -196,8 +196,8 @@ typedef struct thash_cb {
     2.4      u64     hash_sz;        // size of above data.
     2.5      void    *cch_buf;       // base address of collision chain.
     2.6      u64     cch_sz;         // size of above data.
     2.7 +    u64     cch_free_idx;   // index of free entry.
     2.8      thash_data_t *cch_freelist;
     2.9 -    thash_data_t *cch_rec_head;  // cch recycle header
    2.10      PTA     pta;
    2.11  } thash_cb_t;
    2.12