[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-ia64-devel] [PATCH] speedup ptc.e emulation
Hi, 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. Thanks, Kouya Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx> diff -r 40608e5e394e xen/arch/ia64/vmx/vtlb.c --- a/xen/arch/ia64/vmx/vtlb.c Mon Jul 02 21:06:46 2007 -0600 +++ b/xen/arch/ia64/vmx/vtlb.c Fri Jul 13 18:05:08 2007 +0900 @@ -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 40608e5e394e xen/include/asm-ia64/vmmu.h --- a/xen/include/asm-ia64/vmmu.h Mon Jul 02 21:06:46 2007 -0600 +++ b/xen/include/asm-ia64/vmmu.h Fri Jul 13 17:55:36 2007 +0900 @@ -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-ia64-devel mailing list Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-ia64-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |