Change to use large pages for shared runtime data in the shared memory
authorjzhou <jzhou>
Sat, 9 Jul 2011 01:16:05 +0000 (01:16 +0000)
committerjzhou <jzhou>
Sat, 9 Jul 2011 01:16:05 +0000 (01:16 +0000)
Robust/src/Runtime/bamboo/multicorecache.c
Robust/src/Runtime/bamboo/multicorecache.h
Robust/src/Runtime/bamboo/multicoremem.h

index 27710a3432400edc346f48ec5c0c7d1e989805a8..90c6d04e8bf9c2318a1b7b66958ee8d6978a3134 100644 (file)
@@ -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);
index c1b00fc45d0ce70329c1bceaa6d7aa43a4a1b05b..d71b470a8dbaa5dce66a3ea5e379859d4cf5ab99 100644 (file)
@@ -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  
 
index 4dc93afd74c118b5061643cb6fc672c904c6e0e0..d5860a11f5cf8e797547258f2015c9a83c7d0eee 100644 (file)
 #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)))
 
 #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
 #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