From d39bbd3dbd569d60c7f27f68a1f30885a30c3fa3 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 c73821a782..9b34d787e8 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 83c621e386..2a2b178575 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