Move the clearing of the emergency flag down into tracedestroy{init,finish}.

Copied from Perforce
 Change: 188216
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2015-09-03 15:35:38 +01:00
parent b4db3bd09f
commit ef62affc6d
3 changed files with 10 additions and 15 deletions

View file

@ -259,9 +259,6 @@ Bool PolicyStartTrace(Trace *traceReturn, Arena arena)
failCondemn:
TraceDestroyInit(trace);
/* This is an unlikely case, but clear the emergency flag so the next attempt
starts normally. */
ArenaSetEmergency(arena, FALSE);
failStart:
return FALSE;
}

View file

@ -771,6 +771,9 @@ void TraceDestroyInit(Trace trace)
trace->sig = SigInvalid;
trace->arena->busyTraces = TraceSetDel(trace->arena->busyTraces, trace);
/* Clear the emergency flag so the next trace starts normally. */
ArenaSetEmergency(trace->arena, FALSE);
}
@ -828,6 +831,9 @@ void TraceDestroyFinished(Trace trace)
trace->sig = SigInvalid;
trace->arena->busyTraces = TraceSetDel(trace->arena->busyTraces, trace);
trace->arena->flippedTraces = TraceSetDel(trace->arena->flippedTraces, trace);
/* Hopefully the trace reclaimed some memory, so clear any emergency. */
ArenaSetEmergency(trace->arena, FALSE);
}
@ -1833,9 +1839,6 @@ Res TraceStartCollectAll(Trace *traceReturn, Arena arena, int why)
NOTREACHED;
failCondemn:
TraceDestroyInit(trace);
/* We don't know how long it'll be before another collection. Make sure
the next one starts in normal mode. */
ArenaSetEmergency(arena, FALSE);
return res;
}
@ -1873,12 +1876,8 @@ Work TracePoll(Globals globals)
newWork = traceWork(trace);
AVER(newWork >= oldWork);
work = newWork - oldWork;
if (trace->state == TraceFINISHED) {
if (trace->state == TraceFINISHED)
TraceDestroyFinished(trace);
/* A trace finished, and hopefully reclaimed some memory, so clear any
* emergency. */
ArenaSetEmergency(arena, FALSE);
}
return work;
}

View file

@ -591,10 +591,9 @@ void ArenaPark(Globals globals)
}
ArenaAccumulateTime(arena, start);
/* Clear any emergency flag so that the next collection starts normally.
Any traces that have been finished may have reclaimed memory. */
ArenaSetEmergency(arena, FALSE);
/* All traces have finished so there must not be an emergency. */
AVER(!ArenaEmergency(arena));
}
/* ArenaStartCollect -- start a collection of everything in the