From 47b4d6baccd07deb0c8af5cd4d7fbbb7394ed892 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 12 Dec 2013 00:03:22 -0800 Subject: [PATCH] client: fix bugs involving CPU throttling and GPU apps Suspended tasks can be either left in memory (LIM) or removed from memory (RFM). CPU throttling always uses LIM. Other types of suspension (e.g. user request) use LIM or RFM depending on user prefs, except that RFM is always used for GPU tasks. There was a bug: if tasks were suspended because of CPU throttling, and then the user suspended activity, GPU apps would remain LIM. They need to be RFM. --- client/app.cpp | 1 + client/app_control.cpp | 3 +-- client/client_state.cpp | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/client/app.cpp b/client/app.cpp index a7fe77ae5c..54e033e852 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -184,6 +184,7 @@ int ACTIVE_TASK::preempt(int preempt_type) { result->name ); } + if (task_state() != PROCESS_EXECUTING) return 0; return suspend(); } return 0; diff --git a/client/app_control.cpp b/client/app_control.cpp index 0db72e2c72..c4d7bf7a15 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -1055,14 +1055,13 @@ int ACTIVE_TASK_SET::abort_project(PROJECT* project) { void ACTIVE_TASK_SET::suspend_all(int reason) { for (unsigned int i=0; itask_state() != PROCESS_EXECUTING) continue; // handle CPU throttling separately // if (reason == SUSPEND_REASON_CPU_THROTTLE) { if (atp->result->dont_throttle()) continue; atp->preempt(REMOVE_NEVER); - continue;; + continue; } #ifdef ANDROID diff --git a/client/client_state.cpp b/client/client_state.cpp index b07e0d1fb1..27124fbfe4 100644 --- a/client/client_state.cpp +++ b/client/client_state.cpp @@ -864,9 +864,7 @@ bool CLIENT_STATE::poll_slow_events() { if (suspend_reason) { if (!tasks_suspended) { show_suspend_tasks_message(suspend_reason); - if (!tasks_throttled) { - active_tasks.suspend_all(suspend_reason); - } + active_tasks.suspend_all(suspend_reason); } last_suspend_reason = suspend_reason; } else {