diff options
author | Douglas Wilson <douglas.wilson@gmail.com> | 2018-01-21 12:08:19 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-01-21 12:08:20 -0500 |
commit | 180ca65ff6d1b4f3f4cdadc569fd4de107be14db (patch) | |
tree | 4bb39d6e1123897d0988674a25788c8d3bcab691 | |
parent | 5edb18a962cbfee0ff869b1a77ebf2cd79dd8ef5 (diff) | |
download | haskell-180ca65ff6d1b4f3f4cdadc569fd4de107be14db.tar.gz |
[rts] Adjust whitehole_spin
Rename to whitehole_gc_spin, in preparation for adding stats for the
whitehole busy-loop in SMPClosureOps.
Make whitehole_gc_spin volatile, and move it to be defined and
statically initialised in GC.c. This saves some #ifs, and I'm pretty
sure it should be volatile.
Test Plan: ./validate
Reviewers: bgamari, erikd, simonmar
Reviewed By: bgamari
Subscribers: rwbarton, thomie, carter
Differential Revision: https://phabricator.haskell.org/D4300
-rw-r--r-- | rts/Stats.c | 5 | ||||
-rw-r--r-- | rts/sm/Evac.c | 7 | ||||
-rw-r--r-- | rts/sm/GC.c | 4 | ||||
-rw-r--r-- | rts/sm/GC.h | 2 | ||||
-rw-r--r-- | rts/sm/Storage.c | 4 |
5 files changed, 10 insertions, 12 deletions
diff --git a/rts/Stats.c b/rts/Stats.c index fa85878621..26bdac0ea5 100644 --- a/rts/Stats.c +++ b/rts/Stats.c @@ -16,7 +16,7 @@ #include "Profiling.h" #include "GetTime.h" #include "sm/Storage.h" -#include "sm/GC.h" // gc_alloc_block_sync, whitehole_spin +#include "sm/GC.h" // gc_alloc_block_sync, whitehole_gc_spin #include "sm/GCThread.h" #include "sm/BlockAlloc.h" @@ -769,7 +769,8 @@ stat_exit (void) uint32_t g; statsPrintf("gc_alloc_block_sync: %"FMT_Word64"\n", gc_alloc_block_sync.spin); - statsPrintf("whitehole_spin: %"FMT_Word64"\n", whitehole_spin); + statsPrintf("whitehole_gc_spin: %"FMT_Word64"\n" + , whitehole_gc_spin); for (g = 0; g < RtsFlags.GcFlags.generations; g++) { statsPrintf("gen[%d].sync: %"FMT_Word64"\n", g, generations[g].sync.spin); } diff --git a/rts/sm/Evac.c b/rts/sm/Evac.c index 526f063336..738e3e460c 100644 --- a/rts/sm/Evac.c +++ b/rts/sm/Evac.c @@ -28,10 +28,6 @@ #include "CNF.h" #include "Scav.h" -#if defined(PROF_SPIN) && defined(THREADED_RTS) && defined(PARALLEL_GC) -StgWord64 whitehole_spin = 0; -#endif - #if defined(THREADED_RTS) && !defined(PARALLEL_GC) #define evacuate(p) evacuate1(p) #define evacuate_BLACKHOLE(p) evacuate_BLACKHOLE1(p) @@ -197,8 +193,9 @@ spin: info = xchg((StgPtr)&src->header.info, (W_)&stg_WHITEHOLE_info); if (info == (W_)&stg_WHITEHOLE_info) { #if defined(PROF_SPIN) - whitehole_spin++; + whitehole_gc_spin++; #endif + busy_wait_nop(); goto spin; } if (IS_FORWARDING_PTR(info)) { diff --git a/rts/sm/GC.c b/rts/sm/GC.c index 4dbc5e0aa6..c5ab7a8161 100644 --- a/rts/sm/GC.c +++ b/rts/sm/GC.c @@ -133,6 +133,10 @@ uint32_t n_gc_threads; // For stats: static long copied; // *words* copied & scavenged during this GC +#if defined(PROF_SPIN) && defined(THREADED_RTS) +volatile StgWord64 whitehole_gc_spin = 0; +#endif + bool work_stealing; uint32_t static_flag = STATIC_FLAG_B; diff --git a/rts/sm/GC.h b/rts/sm/GC.h index c6b0c13a46..78f054931a 100644 --- a/rts/sm/GC.h +++ b/rts/sm/GC.h @@ -46,7 +46,7 @@ extern uint32_t mutlist_MUTVARS, mutlist_MUTARRS, mutlist_MVARS, mutlist_OTHERS, #endif #if defined(PROF_SPIN) && defined(THREADED_RTS) -extern StgWord64 whitehole_spin; +extern volatile StgWord64 whitehole_gc_spin; #endif void gcWorkerThread (Capability *cap); diff --git a/rts/sm/Storage.c b/rts/sm/Storage.c index e801c340f2..c4dbdc26ca 100644 --- a/rts/sm/Storage.c +++ b/rts/sm/Storage.c @@ -197,11 +197,7 @@ initStorage (void) #if defined(THREADED_RTS) initSpinLock(&gc_alloc_block_sync); -#if defined(PROF_SPIN) - whitehole_spin = 0; #endif -#endif - N = 0; for (n = 0; n < n_numa_nodes; n++) { |