1 /* ---------------------------------------------------------------------------
3 * (c) The GHC Team, 2003-2006
7 * A Capability represent the token required to execute STG code,
8 * and all the state an OS thread/task needs to run Haskell code:
9 * its STG registers, a pointer to its TSO, a nursery etc. During
10 * STG execution, a pointer to the capabilitity is kept in a
11 * register (BaseReg; actually it is a pointer to cap->r).
13 * Only in an THREADED_RTS build will there be multiple capabilities,
14 * for non-threaded builds there is only one global capability, namely
17 * --------------------------------------------------------------------------*/
19 #include "PosixSource.h"
24 #include "OSThreads.h"
25 #include "Capability.h"
31 // one global capability, this is the Capability for non-threaded
32 // builds, and for +RTS -N1
33 Capability MainCapability;
36 Capability *capabilities = NULL;
38 // Holds the Capability which last became free. This is used so that
39 // an in-call has a chance of quickly finding a free Capability.
40 // Maintaining a global free list of Capabilities would require global
41 // locking, so we don't do that.
42 Capability *last_free_capability;
44 /* GC indicator, in scope for the scheduler, init'ed to false */
45 volatile StgWord waiting_for_gc = 0;
47 /* Let foreign code get the current Capability -- assuming there is one!
48 * This is useful for unsafe foreign calls because they are called with
49 * the current Capability held, but they are not passed it. For example,
50 * see see the integer-gmp package which calls allocateLocal() in its
51 * stgAllocForGMP() function (which gets called by gmp functions).
53 Capability * rts_unsafeGetMyCapability (void)
55 #if defined(THREADED_RTS)
58 return &MainCapability;
62 #if defined(THREADED_RTS)
66 return blackholes_need_checking
67 || sched_state >= SCHED_INTERRUPTING
72 #if defined(THREADED_RTS)
74 findSpark (Capability *cap)
81 if (!emptyRunQueue(cap)) {
82 // If there are other threads, don't try to run any new
83 // sparks: sparks might be speculative, we don't want to take
84 // resources away from the main computation.
88 // first try to get a spark from our own pool.
89 // We should be using reclaimSpark(), because it works without
90 // needing any atomic instructions:
91 // spark = reclaimSpark(cap->sparks);
92 // However, measurements show that this makes at least one benchmark
93 // slower (prsa) and doesn't affect the others.
94 spark = tryStealSpark(cap);
96 cap->sparks_converted++;
98 // Post event for running a spark from capability's own pool.
99 postEvent(cap, EVENT_RUN_SPARK, cap->r.rCurrentTSO->id, 0);
104 if (n_capabilities == 1) { return NULL; } // makes no sense...
106 debugTrace(DEBUG_sched,
107 "cap %d: Trying to steal work from other capabilities",
113 /* visit cap.s 0..n-1 in sequence until a theft succeeds. We could
114 start at a random place instead of 0 as well. */
115 for ( i=0 ; i < n_capabilities ; i++ ) {
116 robbed = &capabilities[i];
117 if (cap == robbed) // ourselves...
120 if (emptySparkPoolCap(robbed)) // nothing to steal here
123 spark = tryStealSpark(robbed);
124 if (spark == NULL && !emptySparkPoolCap(robbed)) {
125 // we conflicted with another thread while trying to steal;
131 debugTrace(DEBUG_sched,
132 "cap %d: Stole a spark from capability %d",
133 cap->no, robbed->no);
134 cap->sparks_converted++;
136 postEvent(cap, EVENT_STEAL_SPARK,
137 cap->r.rCurrentTSO->id, robbed->no);
142 // otherwise: no success, try next one
146 debugTrace(DEBUG_sched, "No sparks stolen");
150 // Returns True if any spark pool is non-empty at this moment in time
151 // The result is only valid for an instant, of course, so in a sense
152 // is immediately invalid, and should not be relied upon for
159 for (i=0; i < n_capabilities; i++) {
160 if (!emptySparkPoolCap(&capabilities[i])) {
168 /* -----------------------------------------------------------------------------
169 * Manage the returning_tasks lists.
171 * These functions require cap->lock
172 * -------------------------------------------------------------------------- */
174 #if defined(THREADED_RTS)
176 newReturningTask (Capability *cap, Task *task)
178 ASSERT_LOCK_HELD(&cap->lock);
179 ASSERT(task->return_link == NULL);
180 if (cap->returning_tasks_hd) {
181 ASSERT(cap->returning_tasks_tl->return_link == NULL);
182 cap->returning_tasks_tl->return_link = task;
184 cap->returning_tasks_hd = task;
186 cap->returning_tasks_tl = task;
190 popReturningTask (Capability *cap)
192 ASSERT_LOCK_HELD(&cap->lock);
194 task = cap->returning_tasks_hd;
196 cap->returning_tasks_hd = task->return_link;
197 if (!cap->returning_tasks_hd) {
198 cap->returning_tasks_tl = NULL;
200 task->return_link = NULL;
205 /* ----------------------------------------------------------------------------
208 * The Capability is initially marked not free.
209 * ------------------------------------------------------------------------- */
212 initCapability( Capability *cap, nat i )
217 cap->in_haskell = rtsFalse;
218 cap->in_gc = rtsFalse;
220 cap->run_queue_hd = END_TSO_QUEUE;
221 cap->run_queue_tl = END_TSO_QUEUE;
223 #if defined(THREADED_RTS)
224 initMutex(&cap->lock);
225 cap->running_task = NULL; // indicates cap is free
226 cap->spare_workers = NULL;
227 cap->suspended_ccalling_tasks = NULL;
228 cap->returning_tasks_hd = NULL;
229 cap->returning_tasks_tl = NULL;
230 cap->wakeup_queue_hd = END_TSO_QUEUE;
231 cap->wakeup_queue_tl = END_TSO_QUEUE;
232 cap->sparks_created = 0;
233 cap->sparks_converted = 0;
234 cap->sparks_pruned = 0;
237 cap->f.stgEagerBlackholeInfo = (W_)&__stg_EAGER_BLACKHOLE_info;
238 cap->f.stgGCEnter1 = (F_)__stg_gc_enter_1;
239 cap->f.stgGCFun = (F_)__stg_gc_fun;
241 cap->mut_lists = stgMallocBytes(sizeof(bdescr *) *
242 RtsFlags.GcFlags.generations,
244 cap->saved_mut_lists = stgMallocBytes(sizeof(bdescr *) *
245 RtsFlags.GcFlags.generations,
248 for (g = 0; g < RtsFlags.GcFlags.generations; g++) {
249 cap->mut_lists[g] = NULL;
252 cap->free_tvar_watch_queues = END_STM_WATCH_QUEUE;
253 cap->free_invariant_check_queues = END_INVARIANT_CHECK_QUEUE;
254 cap->free_trec_chunks = END_STM_CHUNK_LIST;
255 cap->free_trec_headers = NO_TREC;
256 cap->transaction_tokens = 0;
257 cap->context_switch = 0;
260 /* ---------------------------------------------------------------------------
261 * Function: initCapabilities()
263 * Purpose: set up the Capability handling. For the THREADED_RTS build,
264 * we keep a table of them, the size of which is
265 * controlled by the user via the RTS flag -N.
267 * ------------------------------------------------------------------------- */
269 initCapabilities( void )
271 #if defined(THREADED_RTS)
275 // We can't support multiple CPUs if BaseReg is not a register
276 if (RtsFlags.ParFlags.nNodes > 1) {
277 errorBelch("warning: multiple CPUs not supported in this build, reverting to 1");
278 RtsFlags.ParFlags.nNodes = 1;
282 n_capabilities = RtsFlags.ParFlags.nNodes;
284 if (n_capabilities == 1) {
285 capabilities = &MainCapability;
286 // THREADED_RTS must work on builds that don't have a mutable
287 // BaseReg (eg. unregisterised), so in this case
288 // capabilities[0] must coincide with &MainCapability.
290 capabilities = stgMallocBytes(n_capabilities * sizeof(Capability),
294 for (i = 0; i < n_capabilities; i++) {
295 initCapability(&capabilities[i], i);
298 debugTrace(DEBUG_sched, "allocated %d capabilities", n_capabilities);
300 #else /* !THREADED_RTS */
303 capabilities = &MainCapability;
304 initCapability(&MainCapability, 0);
308 // There are no free capabilities to begin with. We will start
309 // a worker Task to each Capability, which will quickly put the
310 // Capability on the free list when it finds nothing to do.
311 last_free_capability = &capabilities[0];
314 /* ----------------------------------------------------------------------------
315 * setContextSwitches: cause all capabilities to context switch as
317 * ------------------------------------------------------------------------- */
319 void setContextSwitches(void)
322 for (i=0; i < n_capabilities; i++) {
323 contextSwitchCapability(&capabilities[i]);
327 /* ----------------------------------------------------------------------------
328 * Give a Capability to a Task. The task must currently be sleeping
329 * on its condition variable.
331 * Requires cap->lock (modifies cap->running_task).
333 * When migrating a Task, the migrater must take task->lock before
334 * modifying task->cap, to synchronise with the waking up Task.
335 * Additionally, the migrater should own the Capability (when
336 * migrating the run queue), or cap->lock (when migrating
337 * returning_workers).
339 * ------------------------------------------------------------------------- */
341 #if defined(THREADED_RTS)
343 giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
345 ASSERT_LOCK_HELD(&cap->lock);
346 ASSERT(task->cap == cap);
347 debugTrace(DEBUG_sched, "passing capability %d to %s %p",
348 cap->no, task->tso ? "bound task" : "worker",
350 ACQUIRE_LOCK(&task->lock);
351 task->wakeup = rtsTrue;
352 // the wakeup flag is needed because signalCondition() doesn't
353 // flag the condition if the thread is already runniing, but we want
355 signalCondition(&task->cond);
356 RELEASE_LOCK(&task->lock);
360 /* ----------------------------------------------------------------------------
361 * Function: releaseCapability(Capability*)
363 * Purpose: Letting go of a capability. Causes a
364 * 'returning worker' thread or a 'waiting worker'
365 * to wake up, in that order.
366 * ------------------------------------------------------------------------- */
368 #if defined(THREADED_RTS)
370 releaseCapability_ (Capability* cap,
371 rtsBool always_wakeup)
375 task = cap->running_task;
377 ASSERT_PARTIAL_CAPABILITY_INVARIANTS(cap,task);
379 cap->running_task = NULL;
381 // Check to see whether a worker thread can be given
382 // the go-ahead to return the result of an external call..
383 if (cap->returning_tasks_hd != NULL) {
384 giveCapabilityToTask(cap,cap->returning_tasks_hd);
385 // The Task pops itself from the queue (see waitForReturnCapability())
389 if (waiting_for_gc == PENDING_GC_SEQ) {
390 last_free_capability = cap; // needed?
391 debugTrace(DEBUG_sched, "GC pending, set capability %d free", cap->no);
396 // If the next thread on the run queue is a bound thread,
397 // give this Capability to the appropriate Task.
398 if (!emptyRunQueue(cap) && cap->run_queue_hd->bound) {
399 // Make sure we're not about to try to wake ourselves up
400 ASSERT(task != cap->run_queue_hd->bound);
401 task = cap->run_queue_hd->bound;
402 giveCapabilityToTask(cap,task);
406 if (!cap->spare_workers) {
407 // Create a worker thread if we don't have one. If the system
408 // is interrupted, we only create a worker task if there
409 // are threads that need to be completed. If the system is
410 // shutting down, we never create a new worker.
411 if (sched_state < SCHED_SHUTTING_DOWN || !emptyRunQueue(cap)) {
412 debugTrace(DEBUG_sched,
413 "starting new worker on capability %d", cap->no);
414 startWorkerTask(cap, workerStart);
419 // If we have an unbound thread on the run queue, or if there's
420 // anything else to do, give the Capability to a worker thread.
422 !emptyRunQueue(cap) || !emptyWakeupQueue(cap) ||
423 !emptySparkPoolCap(cap) || globalWorkToDo()) {
424 if (cap->spare_workers) {
425 giveCapabilityToTask(cap,cap->spare_workers);
426 // The worker Task pops itself from the queue;
431 last_free_capability = cap;
432 debugTrace(DEBUG_sched, "freeing capability %d", cap->no);
436 releaseCapability (Capability* cap USED_IF_THREADS)
438 ACQUIRE_LOCK(&cap->lock);
439 releaseCapability_(cap, rtsFalse);
440 RELEASE_LOCK(&cap->lock);
444 releaseAndWakeupCapability (Capability* cap USED_IF_THREADS)
446 ACQUIRE_LOCK(&cap->lock);
447 releaseCapability_(cap, rtsTrue);
448 RELEASE_LOCK(&cap->lock);
452 releaseCapabilityAndQueueWorker (Capability* cap USED_IF_THREADS)
456 ACQUIRE_LOCK(&cap->lock);
458 task = cap->running_task;
460 // If the current task is a worker, save it on the spare_workers
461 // list of this Capability. A worker can mark itself as stopped,
462 // in which case it is not replaced on the spare_worker queue.
463 // This happens when the system is shutting down (see
464 // Schedule.c:workerStart()).
465 // Also, be careful to check that this task hasn't just exited
466 // Haskell to do a foreign call (task->suspended_tso).
467 if (!isBoundTask(task) && !task->stopped && !task->suspended_tso) {
468 task->next = cap->spare_workers;
469 cap->spare_workers = task;
471 // Bound tasks just float around attached to their TSOs.
473 releaseCapability_(cap,rtsFalse);
475 RELEASE_LOCK(&cap->lock);
479 /* ----------------------------------------------------------------------------
480 * waitForReturnCapability( Task *task )
482 * Purpose: when an OS thread returns from an external call,
483 * it calls waitForReturnCapability() (via Schedule.resumeThread())
484 * to wait for permission to enter the RTS & communicate the
485 * result of the external call back to the Haskell thread that
488 * ------------------------------------------------------------------------- */
490 waitForReturnCapability (Capability **pCap, Task *task)
492 #if !defined(THREADED_RTS)
494 MainCapability.running_task = task;
495 task->cap = &MainCapability;
496 *pCap = &MainCapability;
499 Capability *cap = *pCap;
502 // Try last_free_capability first
503 cap = last_free_capability;
504 if (!cap->running_task) {
506 // otherwise, search for a free capability
508 for (i = 0; i < n_capabilities; i++) {
509 if (!capabilities[i].running_task) {
510 cap = &capabilities[i];
515 // Can't find a free one, use last_free_capability.
516 cap = last_free_capability;
520 // record the Capability as the one this Task is now assocated with.
524 ASSERT(task->cap == cap);
527 ACQUIRE_LOCK(&cap->lock);
529 debugTrace(DEBUG_sched, "returning; I want capability %d", cap->no);
531 if (!cap->running_task) {
532 // It's free; just grab it
533 cap->running_task = task;
534 RELEASE_LOCK(&cap->lock);
536 newReturningTask(cap,task);
537 RELEASE_LOCK(&cap->lock);
540 ACQUIRE_LOCK(&task->lock);
541 // task->lock held, cap->lock not held
542 if (!task->wakeup) waitCondition(&task->cond, &task->lock);
544 task->wakeup = rtsFalse;
545 RELEASE_LOCK(&task->lock);
547 // now check whether we should wake up...
548 ACQUIRE_LOCK(&cap->lock);
549 if (cap->running_task == NULL) {
550 if (cap->returning_tasks_hd != task) {
551 giveCapabilityToTask(cap,cap->returning_tasks_hd);
552 RELEASE_LOCK(&cap->lock);
555 cap->running_task = task;
556 popReturningTask(cap);
557 RELEASE_LOCK(&cap->lock);
560 RELEASE_LOCK(&cap->lock);
565 ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
567 debugTrace(DEBUG_sched, "resuming capability %d", cap->no);
573 #if defined(THREADED_RTS)
574 /* ----------------------------------------------------------------------------
576 * ------------------------------------------------------------------------- */
579 yieldCapability (Capability** pCap, Task *task)
581 Capability *cap = *pCap;
583 if (waiting_for_gc == PENDING_GC_PAR) {
584 debugTrace(DEBUG_sched, "capability %d: becoming a GC thread", cap->no);
585 postEvent(cap, EVENT_GC_START, 0, 0);
587 postEvent(cap, EVENT_GC_END, 0, 0);
591 debugTrace(DEBUG_sched, "giving up capability %d", cap->no);
593 // We must now release the capability and wait to be woken up
595 task->wakeup = rtsFalse;
596 releaseCapabilityAndQueueWorker(cap);
599 ACQUIRE_LOCK(&task->lock);
600 // task->lock held, cap->lock not held
601 if (!task->wakeup) waitCondition(&task->cond, &task->lock);
603 task->wakeup = rtsFalse;
604 RELEASE_LOCK(&task->lock);
606 debugTrace(DEBUG_sched, "woken up on capability %d", cap->no);
608 ACQUIRE_LOCK(&cap->lock);
609 if (cap->running_task != NULL) {
610 debugTrace(DEBUG_sched,
611 "capability %d is owned by another task", cap->no);
612 RELEASE_LOCK(&cap->lock);
616 if (task->tso == NULL) {
617 ASSERT(cap->spare_workers != NULL);
618 // if we're not at the front of the queue, release it
619 // again. This is unlikely to happen.
620 if (cap->spare_workers != task) {
621 giveCapabilityToTask(cap,cap->spare_workers);
622 RELEASE_LOCK(&cap->lock);
625 cap->spare_workers = task->next;
628 cap->running_task = task;
629 RELEASE_LOCK(&cap->lock);
633 debugTrace(DEBUG_sched, "resuming capability %d", cap->no);
634 ASSERT(cap->running_task == task);
638 ASSERT_FULL_CAPABILITY_INVARIANTS(cap,task);
643 /* ----------------------------------------------------------------------------
644 * Wake up a thread on a Capability.
646 * This is used when the current Task is running on a Capability and
647 * wishes to wake up a thread on a different Capability.
648 * ------------------------------------------------------------------------- */
651 wakeupThreadOnCapability (Capability *my_cap,
652 Capability *other_cap,
655 ACQUIRE_LOCK(&other_cap->lock);
657 // ASSUMES: cap->lock is held (asserted in wakeupThreadOnCapability)
659 ASSERT(tso->bound->cap == tso->cap);
660 tso->bound->cap = other_cap;
662 tso->cap = other_cap;
664 ASSERT(tso->bound ? tso->bound->cap == other_cap : 1);
666 if (other_cap->running_task == NULL) {
667 // nobody is running this Capability, we can add our thread
668 // directly onto the run queue and start up a Task to run it.
670 other_cap->running_task = myTask();
671 // precond for releaseCapability_() and appendToRunQueue()
673 appendToRunQueue(other_cap,tso);
675 releaseCapability_(other_cap,rtsFalse);
677 appendToWakeupQueue(my_cap,other_cap,tso);
678 other_cap->context_switch = 1;
679 // someone is running on this Capability, so it cannot be
680 // freed without first checking the wakeup queue (see
681 // releaseCapability_).
684 RELEASE_LOCK(&other_cap->lock);
687 /* ----------------------------------------------------------------------------
690 * If a Capability is currently idle, wake up a Task on it. Used to
691 * get every Capability into the GC.
692 * ------------------------------------------------------------------------- */
695 prodCapability (Capability *cap, Task *task)
697 ACQUIRE_LOCK(&cap->lock);
698 if (!cap->running_task) {
699 cap->running_task = task;
700 releaseCapability_(cap,rtsTrue);
702 RELEASE_LOCK(&cap->lock);
705 /* ----------------------------------------------------------------------------
708 * At shutdown time, we want to let everything exit as cleanly as
709 * possible. For each capability, we let its run queue drain, and
710 * allow the workers to stop.
712 * This function should be called when interrupted and
713 * shutting_down_scheduler = rtsTrue, thus any worker that wakes up
714 * will exit the scheduler and call taskStop(), and any bound thread
715 * that wakes up will return to its caller. Runnable threads are
718 * ------------------------------------------------------------------------- */
721 shutdownCapability (Capability *cap, Task *task, rtsBool safe)
727 // Loop indefinitely until all the workers have exited and there
728 // are no Haskell threads left. We used to bail out after 50
729 // iterations of this loop, but that occasionally left a worker
730 // running which caused problems later (the closeMutex() below
731 // isn't safe, for one thing).
733 for (i = 0; /* i < 50 */; i++) {
734 ASSERT(sched_state == SCHED_SHUTTING_DOWN);
736 debugTrace(DEBUG_sched,
737 "shutting down capability %d, attempt %d", cap->no, i);
738 ACQUIRE_LOCK(&cap->lock);
739 if (cap->running_task) {
740 RELEASE_LOCK(&cap->lock);
741 debugTrace(DEBUG_sched, "not owner, yielding");
745 cap->running_task = task;
747 if (cap->spare_workers) {
748 // Look for workers that have died without removing
749 // themselves from the list; this could happen if the OS
750 // summarily killed the thread, for example. This
751 // actually happens on Windows when the system is
752 // terminating the program, and the RTS is running in a
756 for (t = cap->spare_workers; t != NULL; t = t->next) {
757 if (!osThreadIsAlive(t->id)) {
758 debugTrace(DEBUG_sched,
759 "worker thread %p has died unexpectedly", (void *)t->id);
761 cap->spare_workers = t->next;
763 prev->next = t->next;
770 if (!emptyRunQueue(cap) || cap->spare_workers) {
771 debugTrace(DEBUG_sched,
772 "runnable threads or workers still alive, yielding");
773 releaseCapability_(cap,rtsFalse); // this will wake up a worker
774 RELEASE_LOCK(&cap->lock);
779 // If "safe", then busy-wait for any threads currently doing
780 // foreign calls. If we're about to unload this DLL, for
781 // example, we need to be sure that there are no OS threads
782 // that will try to return to code that has been unloaded.
783 // We can be a bit more relaxed when this is a standalone
784 // program that is about to terminate, and let safe=false.
785 if (cap->suspended_ccalling_tasks && safe) {
786 debugTrace(DEBUG_sched,
787 "thread(s) are involved in foreign calls, yielding");
788 cap->running_task = NULL;
789 RELEASE_LOCK(&cap->lock);
794 postEvent(cap, EVENT_SHUTDOWN, 0, 0);
795 debugTrace(DEBUG_sched, "capability %d is stopped.", cap->no);
796 RELEASE_LOCK(&cap->lock);
799 // we now have the Capability, its run queue and spare workers
800 // list are both empty.
802 // ToDo: we can't drop this mutex, because there might still be
803 // threads performing foreign calls that will eventually try to
804 // return via resumeThread() and attempt to grab cap->lock.
805 // closeMutex(&cap->lock);
808 /* ----------------------------------------------------------------------------
811 * Attempt to gain control of a Capability if it is free.
813 * ------------------------------------------------------------------------- */
816 tryGrabCapability (Capability *cap, Task *task)
818 if (cap->running_task != NULL) return rtsFalse;
819 ACQUIRE_LOCK(&cap->lock);
820 if (cap->running_task != NULL) {
821 RELEASE_LOCK(&cap->lock);
825 cap->running_task = task;
826 RELEASE_LOCK(&cap->lock);
831 #endif /* THREADED_RTS */
834 freeCapability (Capability *cap)
836 stgFree(cap->mut_lists);
837 #if defined(THREADED_RTS)
838 freeSparkPool(cap->sparks);
843 freeCapabilities (void)
845 #if defined(THREADED_RTS)
847 for (i=0; i < n_capabilities; i++) {
848 freeCapability(&capabilities[i]);
851 freeCapability(&MainCapability);
855 /* ---------------------------------------------------------------------------
856 Mark everything directly reachable from the Capabilities. When
857 using multiple GC threads, each GC thread marks all Capabilities
858 for which (c `mod` n == 0), for Capability c and thread n.
859 ------------------------------------------------------------------------ */
862 markSomeCapabilities (evac_fn evac, void *user, nat i0, nat delta,
863 rtsBool prune_sparks USED_IF_THREADS)
869 // Each GC thread is responsible for following roots from the
870 // Capability of the same number. There will usually be the same
871 // or fewer Capabilities as GC threads, but just in case there
872 // are more, we mark every Capability whose number is the GC
873 // thread's index plus a multiple of the number of GC threads.
874 for (i = i0; i < n_capabilities; i += delta) {
875 cap = &capabilities[i];
876 evac(user, (StgClosure **)(void *)&cap->run_queue_hd);
877 evac(user, (StgClosure **)(void *)&cap->run_queue_tl);
878 #if defined(THREADED_RTS)
879 evac(user, (StgClosure **)(void *)&cap->wakeup_queue_hd);
880 evac(user, (StgClosure **)(void *)&cap->wakeup_queue_tl);
882 for (task = cap->suspended_ccalling_tasks; task != NULL;
884 debugTrace(DEBUG_sched,
885 "evac'ing suspended TSO %lu", (unsigned long)task->suspended_tso->id);
886 evac(user, (StgClosure **)(void *)&task->suspended_tso);
889 #if defined(THREADED_RTS)
891 pruneSparkQueue (evac, user, cap);
893 traverseSparkQueue (evac, user, cap);
898 #if !defined(THREADED_RTS)
899 evac(user, (StgClosure **)(void *)&blocked_queue_hd);
900 evac(user, (StgClosure **)(void *)&blocked_queue_tl);
901 evac(user, (StgClosure **)(void *)&sleeping_queue);
906 markCapabilities (evac_fn evac, void *user)
908 markSomeCapabilities(evac, user, 0, 1, rtsFalse);