summaryrefslogtreecommitdiff
path: root/rts/Schedule.h
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-09-21 15:49:22 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-09-24 09:22:06 +0100
commit0b79d5cd4687dacf7efd430df7fba9d9a5a5ce32 (patch)
tree3efb44ff81ea3ed7496215961b4e57919375b77b /rts/Schedule.h
parent673b6f50eca6f53cfb13b00e587c403c716baba1 (diff)
downloadhaskell-0b79d5cd4687dacf7efd430df7fba9d9a5a5ce32.tar.gz
Another overhaul of the recent_activity / idle GC handling (#5991)
Improvements: - we now turn off the timer signal in the non-threaded RTS after idleGCDelay. This should make the xmonad users on #5991 happy. - we now turn off the timer signal after idleGCDelay even if the idle GC is disabled with +RTS -I0. - we now do *not* turn off the timer when profiling. - more comments to explain the meaning of the various ACTIVITY_* values
Diffstat (limited to 'rts/Schedule.h')
-rw-r--r--rts/Schedule.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/rts/Schedule.h b/rts/Schedule.h
index 4eb3830323..a44949ebb7 100644
--- a/rts/Schedule.h
+++ b/rts/Schedule.h
@@ -61,12 +61,30 @@ void scheduleWorker (Capability *cap, Task *task);
extern volatile StgWord sched_state;
/*
- * flag that tracks whether we have done any execution in this time slice.
+ * flag that tracks whether we have done any execution in this time
+ * slice, and controls the disabling of the interval timer.
+ *
+ * The timer interrupt transitions ACTIVITY_YES into
+ * ACTIVITY_MAYBE_NO, waits for RtsFlags.GcFlags.idleGCDelayTime,
+ * and then:
+ * - if idle GC is no, set ACTIVITY_INACTIVE and wakeUpRts()
+ * - if idle GC is off, set ACTIVITY_DONE_GC and stopTimer()
+ *
+ * If the scheduler finds ACTIVITY_INACTIVE, then it sets
+ * ACTIVITY_DONE_GC, performs the GC and calls stopTimer().
+ *
+ * If the scheduler finds ACTIVITY_DONE_GC and it has a thread to run,
+ * it enables the timer again with startTimer().
*/
-#define ACTIVITY_YES 0 /* there has been activity in the current slice */
-#define ACTIVITY_MAYBE_NO 1 /* no activity in the current slice */
-#define ACTIVITY_INACTIVE 2 /* a complete slice has passed with no activity */
-#define ACTIVITY_DONE_GC 3 /* like 2, but we've done a GC too */
+#define ACTIVITY_YES 0
+ // the RTS is active
+#define ACTIVITY_MAYBE_NO 1
+ // no activity since the last timer signal
+#define ACTIVITY_INACTIVE 2
+ // RtsFlags.GcFlags.idleGCDelayTime has passed with no activity
+#define ACTIVITY_DONE_GC 3
+ // like ACTIVITY_INACTIVE, but we've done a GC too (if idle GC is
+ // enabled) and the interval timer is now turned off.
/* Recent activity flag.
* Locks required : Transition from MAYBE_NO to INACTIVE