From: jzhou Date: Sat, 9 Jul 2011 01:16:05 +0000 (+0000) Subject: Change to use large pages for shared runtime data in the shared memory X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0e36448813213d72e7558088f5efd584ca5da036;p=IRC.git Change to use large pages for shared runtime data in the shared memory --- diff --git a/Robust/src/Runtime/bamboo/multicorecache.c b/Robust/src/Runtime/bamboo/multicorecache.c index 27710a34..90c6d04e 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.c +++ b/Robust/src/Runtime/bamboo/multicorecache.c @@ -37,7 +37,7 @@ void firstPageConvert(bool origclosefirst, unsigned INTPTR main_factor, unsigned // delta_fator from the next original page int * oldtable_next=&gccachesamplingtbl[oldpage+NUMCORESACTIVE]; for(int tt = 0; tt < NUMCORESACTIVE; tt++) { - (*newtable)=((*newtable)+(*oldtable)*main_factor+(*oldtable_next)*delta_factor); + (*newtable)=(*newtable)+((*oldtable)*main_factor+(*oldtable_next)*delta_factor)>>BAMBOO_PAGE_SIZE_BITS; newtable++; oldtable++; oldtable_next++; @@ -50,7 +50,7 @@ void firstPageConvert(bool origclosefirst, unsigned INTPTR main_factor, unsigned // the start destination page closes first, now compute the revised // profiling info for it. for(int tt = 0; tt < NUMCORESACTIVE; tt++) { - (*newtable)=((*newtable)+(*oldtable)*main_factor); + (*newtable)=(*newtable)+((*oldtable)*main_factor)>>BAMBOO_PAGE_SIZE_BITS; newtable++; oldtable++; } @@ -77,7 +77,7 @@ void restClosedPageConvert(void * current_ptr, unsigned INTPTR main_factor, unsi int *oldtable_next=&gccachesamplingtbl[oldpage+NUMCORESACTIVE]; for(int tt = 0; tt < NUMCORESACTIVE; tt++) { - (*newtable)=((*newtable)+(*oldtable)*main_factor+(*oldtable_next)*delta_factor); + (*newtable)=(*newtable)+((*oldtable)*main_factor+(*oldtable_next)*delta_factor)>>BAMBOO_PAGE_SIZE_BITS; newtable++; oldtable++; oldtable_next++; @@ -104,7 +104,7 @@ void lastPageConvert(void * current_ptr) { int *oldtable=&gccachesamplingtbl[oldpage]; for(int tt = 0; tt < NUMCORESACTIVE; tt++) { - (*newtable)=((*newtable)+(*oldtable)*to_factor); + (*newtable)=(*newtable)+((*oldtable)*to_factor)>>BAMBOO_PAGE_SIZE_BITS; newtable++; oldtable++; } @@ -174,7 +174,7 @@ void samplingDataConvert(void * current_ptr) { int * oldtable=&gccachesamplingtbl[oldpage]; for(int tt = 0; tt < NUMCORESACTIVE; tt++) { - (*newtable)=((*newtable)+(*oldtable)*tmp_factor); + (*newtable)=(*newtable)+((*oldtable)*tmp_factor)>>BAMBOO_PAGE_SIZE_BITS; newtable++; oldtable++; } @@ -516,7 +516,7 @@ void gc_output_cache_sampling_r() { int accesscore = 0; // TODO int * local_tbl = &gccachesamplingtbl_r[page_index*NUMCORESACTIVE]; for(int i = 0; i < NUMCORESACTIVE; i++) { - int freq = *local_tbl; ///BAMBOO_PAGE_SIZE; + int freq = *local_tbl; printf("%d, ", freq); if(freq != 0) { accesscore++;// TODO @@ -524,9 +524,9 @@ void gc_output_cache_sampling_r() { local_tbl++; } if(accesscore!=0) { - int * local_tbl = &gccachesamplingtbl_r[page_index]; + int * local_tbl = &gccachesamplingtbl_r[page_index*NUMCORESACTIVE]; for(int i = 0; i < NUMCORESACTIVE; i++) { - int freq = *local_tbl; ///BAMBOO_PAGE_SIZE; + int freq = *local_tbl; sumdata[accesscore-1][i]+=freq; local_tbl++; } @@ -534,6 +534,7 @@ void gc_output_cache_sampling_r() { printf("\n"); } + printf("+++++\n"); // TODO printout the summary data for(int i = 0; i < NUMCORESACTIVE; i++) { printf("%d ", i); diff --git a/Robust/src/Runtime/bamboo/multicorecache.h b/Robust/src/Runtime/bamboo/multicorecache.h index c1b00fc4..d71b470a 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.h +++ b/Robust/src/Runtime/bamboo/multicorecache.h @@ -9,7 +9,7 @@ #ifdef GC_CACHE_ADAPT // sampling unit to compute access frequency, this should be consistent all the // time. -#define GC_CACHE_SAMPLING_UNIT 0x80000 +#define GC_CACHE_SAMPLING_UNIT 0x1000000 // freqeuency to trigger timer interrupt #define GC_TILE_TIMER_EVENT_SETTING 10000000 diff --git a/Robust/src/Runtime/bamboo/multicoremem.h b/Robust/src/Runtime/bamboo/multicoremem.h index 4dc93afd..d5860a11 100644 --- a/Robust/src/Runtime/bamboo/multicoremem.h +++ b/Robust/src/Runtime/bamboo/multicoremem.h @@ -31,10 +31,13 @@ #endif #endif +#define BAMBOO_SHARED_RUNTIME_PAGE_SIZE (1<<24) //16M + #ifdef GC_DEBUG #include "structdefs.h" #define BAMBOO_NUM_BLOCKS (NUMCORES4GC*(2+3)) #define BAMBOO_PAGE_SIZE (64 * 64) +#define BAMBOO_PAGE_SIZE_BITS (12) #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #define BAMBOO_SHARED_MEM_SIZE ((unsigned int)((BAMBOO_SMEM_SIZE) *(BAMBOO_NUM_BLOCKS))) @@ -47,8 +50,10 @@ #define BAMBOO_NUM_BLOCKS ((unsigned int)((GC_BAMBOO_NUMCORES)*(2+14))) #endif #define BAMBOO_PAGE_SIZE ((unsigned int)(64 * 1024)) // 64K +#define BAMBOO_PAGE_SIZE_BITS (16) #ifdef GC_LARGEPAGESIZE #define BAMBOO_PAGE_SIZE ((unsigned int)(4 * 64 * 1024)) +#define BAMBOO_PAGE_SIZE_BITS (18) #define BAMBOO_SMEM_SIZE ((unsigned int)(4 * (BAMBOO_PAGE_SIZE))) #elif defined GC_SMALLPAGESIZE #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) @@ -57,6 +62,7 @@ #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #elif defined GC_LARGEPAGESIZE2 #define BAMBOO_PAGE_SIZE ((unsigned int)(4 * 64 * 1024)) // 64K +#define BAMBOO_PAGE_SIZE_BITS (18) #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #elif defined MGC #define BAMBOO_SMEM_SIZE ((unsigned int)(16*(BAMBOO_PAGE_SIZE))) // 1M @@ -75,15 +81,19 @@ #endif #ifdef GC_LARGEPAGESIZE #define BAMBOO_PAGE_SIZE ((unsigned int)(4 * 1024 * 1024)) // (4096) +#define BAMBOO_PAGE_SIZE_BITS (22) #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #elif defined GC_SMALLPAGESIZE #define BAMBOO_PAGE_SIZE ((unsigned int)(256 * 1024)) // (4096) +#define BAMBOO_PAGE_SIZE_BITS (18) #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #elif defined GC_SMALLPAGESIZE2 #define BAMBOO_PAGE_SIZE ((unsigned int)(256 * 1024)) // (4096) 64 +#define BAMBOO_PAGE_SIZE_BITS (18) #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #else #define BAMBOO_PAGE_SIZE ((unsigned int)(1024 * 1024)) // (4096) +#define BAMBOO_PAGE_SIZE_BITS (20) #define BAMBOO_SMEM_SIZE ((unsigned int)(BAMBOO_PAGE_SIZE)) #endif // GC_LARGEPAGESIZE #define BAMBOO_SHARED_MEM_SIZE ((unsigned int)((BAMBOO_SMEM_SIZE) * (BAMBOO_NUM_BLOCKS))) //(1024 * 1024 * 240) //((unsigned long long int)(3.0 * 1024 * 1024 * 1024)) // 3G