Skip to content
  • Simon Marlow's avatar
    Parallelise clearNurseries() in the parallel GC · 713cf473
    Simon Marlow authored
    The clearNurseries() operation resets the free pointer in each nursery
    block to the start of the block, emptying the nursery.  In the
    parallel GC this was done on the main GC thread, but that's bad
    because it accesses the bdescr of every nursery block, and move all
    those cache lines onto the CPU of the main GC thread.  With large
    nurseries, this can be especially bad.  So instead we want to clear
    each nursery in its local GC thread.
    
    Thanks to Andreas Voellmy <andreas.voellmy@gmail.com> for idenitfying
    the issue.
    
    After this change and the previous patch to make the last GC a major
    one, I see these results for nofib/parallel on 8 cores:
    
       blackscholes          +0.0%     +0.0%     -3.7%     -3.3%     +0.3%
              coins          +0.0%     +0.0%     -5.1%     -5.0%     +0.4%
               gray          +0.0%     +0.0%     -4.5%     -2.1%     +0.8%
             mandel          +0.0%     -0.0%     -7.6%     -5.1%     -2.3%
            matmult          +0.0%     +5.5%     -2.8%     -1.9%     -5.8%
            minimax          +0.0%     +0.0%    -10.6%    -10.5%     +0.0%
              nbody          +0.0%     -4.4%     +0.0%      0.07     +0.0%
             parfib          +0.0%     +1.0%     +0.5%     +0.9%     +0.0%
            partree          +0.0%     +0.0%     -2.4%     -2.5%     +1.7%
               prsa          +0.0%     -0.2%     +1.8%     +4.2%     +0.0%
             queens          +0.0%     -0.0%     -1.8%     -1.4%     -4.8%
                ray          +0.0%     -0.6%    -18.5%    -17.8%     +0.0%
           sumeuler          +0.0%     -0.0%     -3.7%     -3.7%     +0.0%
          transclos          +0.0%     -0.0%    -25.7%    -26.6%     +0.0%
    --------------------------------------------------------------------------------
                Min          +0.0%     -4.4%    -25.7%    -26.6%     -5.8%
                Max          +0.0%     +5.5%     +1.8%     +4.2%     +1.7%
     Geometric Mean          +0.0%     +0.1%     -6.3%     -6.1%     -0.7%
    713cf473