From f9ed0fd23dca0515c4281e7a0d8c8ae1ee4af46f Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sat, 28 Sep 2019 17:37:35 +0000 Subject: rts: Use relaxed atomics for whitehole spin stats --- rts/SMPClosureOps.h | 4 ++-- rts/ThreadPaused.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rts/SMPClosureOps.h b/rts/SMPClosureOps.h index 3191a8c600..2df88db06c 100644 --- a/rts/SMPClosureOps.h +++ b/rts/SMPClosureOps.h @@ -62,12 +62,12 @@ EXTERN_INLINE StgInfoTable *reallyLockClosure(StgClosure *p) info = xchg((P_)(void *)&p->header.info, (W_)&stg_WHITEHOLE_info); if (info != (W_)&stg_WHITEHOLE_info) return (StgInfoTable *)info; #if defined(PROF_SPIN) - ++whitehole_lockClosure_spin; + NONATOMIC_ADD(&whitehole_lockClosure_spin, 1); #endif busy_wait_nop(); } while (++i < SPIN_COUNT); #if defined(PROF_SPIN) - ++whitehole_lockClosure_yield; + NONATOMIC_ADD(&whitehole_lockClosure_yield, 1); #endif yieldThread(); } while (1); diff --git a/rts/ThreadPaused.c b/rts/ThreadPaused.c index 3404c20418..13fc2b4ca0 100644 --- a/rts/ThreadPaused.c +++ b/rts/ThreadPaused.c @@ -331,7 +331,7 @@ threadPaused(Capability *cap, StgTSO *tso) if (cur_bh_info != bh_info) { bh_info = cur_bh_info; #if defined(PROF_SPIN) - ++whitehole_threadPaused_spin; + NONATOMIC_ADD(&whitehole_threadPaused_spin, 1); #endif busy_wait_nop(); goto retry; -- cgit v1.2.1