diff VMS.c @ 173:bfaebdf60df3

coreLoop: All written variables are now on local stack or in seperate cache line
author Merten Sach <msach@mailbox.tu-berlin.de>
date Tue, 20 Dec 2011 15:39:30 +0100
parents d1dd9e6ee72c
children c3f458403cd6
line diff
     1.1 --- a/VMS.c	Tue Dec 20 15:08:29 2011 +0100
     1.2 +++ b/VMS.c	Tue Dec 20 15:39:30 2011 +0100
     1.3 @@ -100,7 +100,7 @@
     1.4  
     1.5  
     1.6        //Make the master env, which holds everything else
     1.7 -   _VMSMasterEnv = malloc(   sizeof(MasterEnv) );
     1.8 +   posix_memalign((void*)&_VMSMasterEnv, CACHELINE_SIZE, sizeof(MasterEnv) );
     1.9     memset( _VMSMasterEnv, 0, sizeof(MasterEnv) );
    1.10  
    1.11          //Very first thing put into the master env is the free-list, seeded
    1.12 @@ -143,12 +143,12 @@
    1.13        masterVPs[ coreIdx ] = VMS__create_procr( (VirtProcrFnPtr)&masterLoop, (void*)masterEnv );
    1.14        masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx;
    1.15        allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core
    1.16 -      _VMSMasterEnv->numMasterInARow[ coreIdx ] = 0;
    1.17 +      //_VMSMasterEnv->numMasterInARow[ coreIdx ] = 0; //moved to coreLoops stack, reason: avoid false sharing
    1.18        _VMSMasterEnv->workStealingGates[ coreIdx ] = NULL;
    1.19      }
    1.20     _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs;
    1.21     _VMSMasterEnv->masterVPs        = masterVPs;
    1.22 -   _VMSMasterEnv->masterLock       = UNLOCKED;
    1.23 +   _VMSMasterEnv->masterLockUnion.masterLock       = UNLOCKED;
    1.24     _VMSMasterEnv->allSchedSlots    = allSchedSlots;
    1.25     _VMSMasterEnv->workStealingLock = UNLOCKED;
    1.26  
    1.27 @@ -288,8 +288,8 @@
    1.28   { VirtProcr *newPr;
    1.29     void      *stackLocs;
    1.30  
    1.31 -   newPr      = VMS__malloc( sizeof(VirtProcr) );
    1.32 -   stackLocs  = VMS__malloc( VIRT_PROCR_STACK_SIZE );
    1.33 +   posix_memalign((void*)&newPr, CACHELINE_SIZE, sizeof(VirtProcr) ); //align to cacheline
    1.34 +   posix_memalign(&stackLocs, CACHELINE_SIZE, VIRT_PROCR_STACK_SIZE ); //align to cacheline
    1.35     if( stackLocs == 0 )
    1.36      { perror("VMS__malloc stack"); exit(1); }
    1.37  
    1.38 @@ -590,8 +590,8 @@
    1.39        // itself
    1.40        //Note, should not stack-allocate initial data -- no guarantee, in
    1.41        // general that creating processor will outlive ones it creates.
    1.42 -   VMS__free( animatingPr->startOfStack );
    1.43 -   VMS__free( animatingPr );
    1.44 +   //VMS__free( animatingPr->startOfStack );
    1.45 +   //VMS__free( animatingPr );
    1.46   }
    1.47  
    1.48