# HG changeset patch # User Merten Sach # Date 1324396221 -3600 # Node ID c3f458403cd6441e3d4b1db1471990b78d9a525c # Parent bfaebdf60df3045cb7f9abc4ba9db49a8a349626 Always allocate more than 256 byte, measurements removed in master loop, aligned slots diff -r bfaebdf60df3 -r c3f458403cd6 MasterLoop.c --- a/MasterLoop.c Tue Dec 20 15:39:30 2011 +0100 +++ b/MasterLoop.c Tue Dec 20 16:50:21 2011 +0100 @@ -95,7 +95,18 @@ uint64 numCycles; //========================================================== - //masterLoopStartPt: + masterEnv = (MasterEnv*)_VMSMasterEnv; + + masterVP = (VirtProcr*)volatilemasterVP; //just to make sure after jmp + thisCoresIdx = masterVP->coreAnimatedBy; + readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; + schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; + + requestHandler = masterEnv->requestHandler; + slaveScheduler = masterEnv->slaveScheduler; + semanticEnv = masterEnv->semanticEnv; + + //masterLoopStartPt: while(1){ //switch to core_loop and back to here is at end of loop //============================= MEASUREMENT STUFF ======================= @@ -107,22 +118,12 @@ #endif //======================================================================= - masterEnv = (MasterEnv*)_VMSMasterEnv; - - //GCC may optimize so doesn't always re-define from frame-storage - masterVP = (VirtProcr*)volatilemasterVP; //just to make sure after jmp - thisCoresIdx = masterVP->coreAnimatedBy; - readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; - schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; - - requestHandler = masterEnv->requestHandler; - slaveScheduler = masterEnv->slaveScheduler; - semanticEnv = masterEnv->semanticEnv; - //Poll each slot's Done flag numSlotsFilled = 0; + /* Meas_startMasterLoop + */ for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) { currSlot = schedSlots[ slotIdx ]; @@ -133,9 +134,13 @@ currSlot->needsProcrAssigned = TRUE; //process requests from slave to master + /* Meas_startReqHdlr + */ (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); + /* Meas_endReqHdlr + */ } if( currSlot->needsProcrAssigned ) { //give slot a new virt procr @@ -152,7 +157,9 @@ } } } + /* Meas_endMasterLoop + */ #ifdef USE_WORK_STEALING //If no slots filled, means no more work, look for work to steal. diff -r bfaebdf60df3 -r c3f458403cd6 VMS.c --- a/VMS.c Tue Dec 20 15:39:30 2011 +0100 +++ b/VMS.c Tue Dec 20 16:50:21 2011 +0100 @@ -187,11 +187,13 @@ { SchedSlot **schedSlots; int i; - schedSlots = VMS__malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) ); + //schedSlots = VMS__malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) ); + posix_memalign(&schedSlots, CACHELINE_SIZE, NUM_SCHED_SLOTS * sizeof(SchedSlot *)); for( i = 0; i < NUM_SCHED_SLOTS; i++ ) { - schedSlots[i] = VMS__malloc( sizeof(SchedSlot) ); + //schedSlots[i] = VMS__malloc( sizeof(SchedSlot) ); + posix_memalign(&schedSlots[i], CACHELINE_SIZE, sizeof(SchedSlot) ); //Set state to mean "handling requests done, slot needs filling" schedSlots[i]->workIsDone = FALSE; @@ -590,8 +592,8 @@ // itself //Note, should not stack-allocate initial data -- no guarantee, in // general that creating processor will outlive ones it creates. - //VMS__free( animatingPr->startOfStack ); - //VMS__free( animatingPr ); + free( animatingPr->startOfStack ); + free( animatingPr ); } diff -r bfaebdf60df3 -r c3f458403cd6 vmalloc.c --- a/vmalloc.c Tue Dec 20 15:39:30 2011 +0100 +++ b/vmalloc.c Tue Dec 20 16:50:21 2011 +0100 @@ -212,6 +212,8 @@ #endif //======================================================================== + sizeRequested += CACHELINE_SIZE; //Allocate more than cacheline_size to avoid false sharing + MallocArrays* freeLists = _VMSMasterEnv->freeLists; MallocProlog* foundChunk;