Commit 5d091088 authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Move allocation of spark pools into initCapability

Rather than a separate phase of initSparkPools. It means all the spark
stuff for a capability is initialisaed at the same time, which is then
becomes a good place to stick an initial spark trace event.
parent ddb47a91
...@@ -232,6 +232,7 @@ initCapability( Capability *cap, nat i ) ...@@ -232,6 +232,7 @@ initCapability( Capability *cap, nat i )
cap->returning_tasks_hd = NULL; cap->returning_tasks_hd = NULL;
cap->returning_tasks_tl = NULL; cap->returning_tasks_tl = NULL;
cap->inbox = (Message*)END_TSO_QUEUE; cap->inbox = (Message*)END_TSO_QUEUE;
cap->sparks = allocSparkPool();
cap->spark_stats.created = 0; cap->spark_stats.created = 0;
cap->spark_stats.dud = 0; cap->spark_stats.dud = 0;
cap->spark_stats.overflowed = 0; cap->spark_stats.overflowed = 0;
......
...@@ -2010,10 +2010,6 @@ initScheduler(void) ...@@ -2010,10 +2010,6 @@ initScheduler(void)
initTaskManager(); initTaskManager();
#if defined(THREADED_RTS)
initSparkPools();
#endif
RELEASE_LOCK(&sched_mutex); RELEASE_LOCK(&sched_mutex);
#if defined(THREADED_RTS) #if defined(THREADED_RTS)
......
...@@ -17,14 +17,10 @@ ...@@ -17,14 +17,10 @@
#if defined(THREADED_RTS) #if defined(THREADED_RTS)
void SparkPool *
initSparkPools( void ) allocSparkPool( void )
{ {
/* walk over the capabilities, allocating a spark pool for each one */ return newWSDeque(RtsFlags.ParFlags.maxLocalSparks);
nat i;
for (i = 0; i < n_capabilities; i++) {
capabilities[i].sparks = newWSDeque(RtsFlags.ParFlags.maxLocalSparks);
}
} }
void void
......
...@@ -30,7 +30,7 @@ typedef struct { ...@@ -30,7 +30,7 @@ typedef struct {
typedef WSDeque SparkPool; typedef WSDeque SparkPool;
// Initialisation // Initialisation
void initSparkPools (void); SparkPool *allocSparkPool (void);
// Take a spark from the "write" end of the pool. Can be called // Take a spark from the "write" end of the pool. Can be called
// by the pool owner only. // by the pool owner only.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment