Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
obsidiansystems
GHC
Commits
d15cb49d
Commit
d15cb49d
authored
Nov 06, 2008
by
Simon Marlow
Browse files
re-instate counting of sparks converted
lost in patch "Run sparks in batches"
parent
a650cec6
Changes
3
Hide whitespace changes
Inline
Side-by-side
rts/Capability.c
View file @
d15cb49d
...
...
@@ -55,7 +55,7 @@ globalWorkToDo (void)
#if defined(THREADED_RTS)
StgClosure
*
stealWo
rk
(
Capability
*
cap
)
findSpa
rk
(
Capability
*
cap
)
{
/* use the normal Sparks.h interface (internally modified to enable
concurrent stealing)
...
...
@@ -66,12 +66,24 @@ stealWork (Capability *cap)
rtsBool
retry
;
nat
i
=
0
;
// first try to get a spark from our own pool.
// We should be using reclaimSpark(), because it works without
// needing any atomic instructions:
// spark = reclaimSpark(cap->sparks);
// However, measurements show that this makes at least one benchmark
// slower (prsa) and doesn't affect the others.
spark
=
tryStealSpark
(
cap
);
if
(
spark
!=
NULL
)
{
cap
->
sparks_converted
++
;
return
spark
;
}
if
(
n_capabilities
==
1
)
{
return
NULL
;
}
// makes no sense...
debugTrace
(
DEBUG_sched
,
"cap %d: Trying to steal work from other capabilities"
,
cap
->
no
);
if
(
n_capabilities
==
1
)
{
return
NULL
;
}
// makes no sense...
do
{
retry
=
rtsFalse
;
...
...
@@ -96,6 +108,7 @@ stealWork (Capability *cap)
debugTrace
(
DEBUG_sched
,
"cap %d: Stole a spark from capability %d"
,
cap
->
no
,
robbed
->
no
);
cap
->
sparks_converted
++
;
return
spark
;
}
// otherwise: no success, try next one
...
...
rts/Capability.h
View file @
d15cb49d
...
...
@@ -245,9 +245,9 @@ void shutdownCapability (Capability *cap, Task *task, rtsBool wait_foreign);
//
rtsBool
tryGrabCapability
(
Capability
*
cap
,
Task
*
task
);
// Try to
steal
a spark
from other Capabilities
// Try to
find
a spark
to run
//
StgClosure
*
stealWo
rk
(
Capability
*
cap
);
StgClosure
*
findSpa
rk
(
Capability
*
cap
);
// True if any capabilities have sparks
//
...
...
rts/PrimOps.cmm
View file @
d15cb49d
...
...
@@ -2295,17 +2295,11 @@ getSparkzh_fast
#if
ndef
THREADED_RTS
RET_NP
(
0
,
ghczmprim_GHCziBool_False_closure
);
#else
(
spark
)
=
foreign
"
C
"
trySteal
Spark
(
MyCapability
());
(
spark
)
=
foreign
"
C
"
find
Spark
(
MyCapability
());
if
(
spark
!=
0
)
{
RET_NP
(
1
,
spark
);
}
else
{
(
spark
)
=
foreign
"
C
"
stealWork
(
MyCapability
());
if
(
spark
!=
0
)
{
RET_NP
(
1
,
spark
);
}
else
{
RET_NP
(
0
,
ghczmprim_GHCziBool_False_closure
);
}
RET_NP
(
0
,
ghczmprim_GHCziBool_False_closure
);
}
#endif
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment