[commit: ghc] ghc-lwc2: Removing checks from setSContCapability. Races in stg_atomicSwitch causes SCont stealing to fail. (9bfbcf8)
Sivaramakrishnan Krishnamoorthy Chandrasekaran
t-sichan at microsoft.com
Mon May 6 21:41:04 CEST 2013
Repository : http://darcs.haskell.org/ghc.git/
On branch : ghc-lwc2
https://github.com/ghc/ghc/commit/9bfbcf81e797c316dcd61f43f1a2e45be9bf6067
>---------------------------------------------------------------
commit 9bfbcf81e797c316dcd61f43f1a2e45be9bf6067
Author: KC Sivaramakrishnan <chandras at cs.purdue.edu>
Date: Sun May 5 23:41:08 2013 -0400
Removing checks from setSContCapability. Races in stg_atomicSwitch causes SCont stealing to fail.
>---------------------------------------------------------------
libraries/base/LwConc/Substrate.hs | 8 ++------
rts/Threads.c | 1 -
tests/Benchmarks/Sieve/ConcurrentListStealing.hs | 2 +-
tests/Benchmarks/Sieve/Makefile | 2 +-
4 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/libraries/base/LwConc/Substrate.hs b/libraries/base/LwConc/Substrate.hs
index 7b1d608..afa5c57 100644
--- a/libraries/base/LwConc/Substrate.hs
+++ b/libraries/base/LwConc/Substrate.hs
@@ -648,16 +648,12 @@ getSContCapabilityIO (SCont sc) = IO $
\s -> case getSContCapability# sc s of
(# s, n #) -> (# s, I# n #)
-
--- We must own the capability (i.e, scont->cap == MyCapability ()). Otherwise,
--- will throw a runtime error.
+-- Updates tso->cap to given cap
setSContCapability :: SCont -> Int -> IO ()
setSContCapability (SCont sc) (I# i) = do
cc <- getCurrentCapabilityIO
scc <- getSContCapabilityIO $ SCont sc
- if cc == scc
- then IO $ \s -> case setSContCapability# sc i s of s -> (# s, () #)
- else error "setSContCapability: SCont must belong to the current capability"
+ IO $ \s -> case setSContCapability# sc i s of s -> (# s, () #)
sleepCapability :: PTM a
sleepCapability = PTM $ \s -> sleepCapability# s
diff --git a/rts/Threads.c b/rts/Threads.c
index 9155cda..63ca915 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -248,7 +248,6 @@ setOwningCapability (Capability *cap USED_IF_DEBUG,
nat target) {
debugTrace (DEBUG_sched, "cap %d: Setting the capability of thread %d to %d",
cap->no, tso->id, target);
- ASSERT (cap == tso->cap);
ASSERT (target < enabled_capabilities);
tso->cap = &capabilities[target];
}
diff --git a/tests/Benchmarks/Sieve/ConcurrentListStealing.hs b/tests/Benchmarks/Sieve/ConcurrentListStealing.hs
index c5d84f2..fb2cfcb 100644
--- a/tests/Benchmarks/Sieve/ConcurrentListStealing.hs
+++ b/tests/Benchmarks/Sieve/ConcurrentListStealing.hs
@@ -15,7 +15,7 @@
-----------------------------------------------------------------------------
-module ConcurrentList
+module ConcurrentListStealing
(
Sched
, SCont
diff --git a/tests/Benchmarks/Sieve/Makefile b/tests/Benchmarks/Sieve/Makefile
index 96e57da..ac8d646 100644
--- a/tests/Benchmarks/Sieve/Makefile
+++ b/tests/Benchmarks/Sieve/Makefile
@@ -3,7 +3,7 @@ TARGET := sieve-vanilla.bin sieve-lwc.bin sieve-TMVar.bin sieve-vanilla-TMVar.bi
include ../../config.mk
TOP := ../../../
-GHC_OPTS_EXTRA=-O2 -threaded -XBangPatterns -XCPP -XGeneralizedNewtypeDeriving -funbox-strict-fields -optc-O3 -debug
+GHC_OPTS_EXTRA=-threaded -XBangPatterns -XCPP -XGeneralizedNewtypeDeriving -funbox-strict-fields -O2 -optc-O3 -debug
PROFILE_FLAGS := -DPROFILE_ENABLED -prof -auto-all -fprof-auto
More information about the ghc-commits
mailing list