Client: fix bug that caused lots of spurious "no shared memory segment" msgs

ACTIVE_TASK_SET::suspend_all() originally skipped tasks
in states other than PROCESS_EXECUTING.
I took this out in commit 47b4d6b because - for example -
a GPU task might be suspended due to CPU throttling,
and therefore left in memory,
but if it's then suspended for some other reason,
it must be removed from memory.

However, this change was overkill - it causes tasks for which
no process exists to be suspended, resulting in the spurious msgs.

Solution: skip tasks in states other than PROCESS_EXECUTING
and PROCESS_SUSPENDED.
This commit is contained in:
David Anderson 2014-01-07 12:29:08 -08:00
parent 67a0bca083
commit b2f0bc0c21
1 changed files with 17 additions and 1 deletions

View File

@ -1056,6 +1056,23 @@ void ACTIVE_TASK_SET::suspend_all(int reason) {
for (unsigned int i=0; i<active_tasks.size(); i++) {
ACTIVE_TASK* atp = active_tasks[i];
// don't suspend if process doesn't exist,
// or if quit/abort is pending.
// If process is currently suspended, proceed;
// the new suspension may require it to be removed from memory.
// E.g. a GPU job may currently be suspended due to CPU throttling,
// and therefore left in memory,
// but this suspension (say, a user request)
// might require it to be removed from memory.
//
switch (atp->task_state()) {
case PROCESS_EXECUTING:
case PROCESS_SUSPENDED:
break;
default:
continue;
}
// handle CPU throttling separately
//
if (reason == SUSPEND_REASON_CPU_THROTTLE) {
@ -1484,4 +1501,3 @@ void ACTIVE_TASK::read_task_state_file() {
}
}
}