Commit 396f0903 authored by Simon Marlow's avatar Simon Marlow

Fix a bug in the handling of recent_activity

The problem occurred when the idle GC was turned off with +RTS -I0.
Then the scheduler would go into the state ACTIVITY_DONE_GC directly
without doing a GC, and a subsequent GC would put it back to
ACTIVITY_YES but without turning the timer back on.  Instead if the GC
finds the state is ACTIVITY_DONE_GC it should leave it there.
parent 69cda9ef
......@@ -1658,21 +1658,30 @@ delete_threads_and_gc:
traceSparkCounters(cap);
if (recent_activity == ACTIVITY_INACTIVE && force_major)
{
// We are doing a GC because the system has been idle for a
// timeslice and we need to check for deadlock. Record the
// fact that we've done a GC and turn off the timer signal;
// it will get re-enabled if we run any threads after the GC.
recent_activity = ACTIVITY_DONE_GC;
stopTimer();
}
else
{
switch (recent_activity) {
case ACTIVITY_INACTIVE:
if (force_major) {
// We are doing a GC because the system has been idle for a
// timeslice and we need to check for deadlock. Record the
// fact that we've done a GC and turn off the timer signal;
// it will get re-enabled if we run any threads after the GC.
recent_activity = ACTIVITY_DONE_GC;
stopTimer();
break;
}
// fall through...
case ACTIVITY_MAYBE_NO:
// the GC might have taken long enough for the timer to set
// recent_activity = ACTIVITY_INACTIVE, but we aren't
// necessarily deadlocked:
// recent_activity = ACTIVITY_MAYBE_NO or ACTIVITY_INACTIVE,
// but we aren't necessarily deadlocked:
recent_activity = ACTIVITY_YES;
break;
case ACTIVITY_DONE_GC:
// If we are actually active, the scheduler will reset the
// recent_activity flag and re-enable the timer.
break;
}
#if defined(THREADED_RTS)
......
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