diff options
author | Jason Parks <jparks@google.com> | 2009-11-03 12:14:38 -0800 |
---|---|---|
committer | Jason Parks <jparks@google.com> | 2009-11-03 13:10:15 -0800 |
commit | dabcf4151adeb1376ce3b6c9f4b060f9b7fd8a16 (patch) | |
tree | 1fcf1df262a9bc4b707c33e5ab7139c5a23b6f9a /libs/binder | |
parent | d2c68794364120d0531667e797f078416ebef3f5 (diff) | |
download | frameworks_base-dabcf4151adeb1376ce3b6c9f4b060f9b7fd8a16.zip frameworks_base-dabcf4151adeb1376ce3b6c9f4b060f9b7fd8a16.tar.gz frameworks_base-dabcf4151adeb1376ce3b6c9f4b060f9b7fd8a16.tar.bz2 |
Add a warning when we leave threads in the binder thread pool in the background scheduling group.
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/IPCThreadState.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index c371a23..86c3df6 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -14,10 +14,13 @@ * limitations under the License. */ +#define LOG_TAG "IPCThreadState" + #include <binder/IPCThreadState.h> #include <binder/Binder.h> #include <binder/BpBinder.h> +#include <cutils/sched_policy.h> #include <utils/Debug.h> #include <utils/Log.h> #include <utils/TextOutput.h> @@ -418,7 +421,32 @@ void IPCThreadState::joinThreadPool(bool isMain) alog << "Processing top-level Command: " << getReturnString(cmd) << endl; } + + bool isTainted = false; + + { + SchedPolicy policy; + get_sched_policy(getpid(), &policy); + + if (policy == SP_BACKGROUND) { + isTainted = true; + } + } + result = executeCommand(cmd); + + // Make sure that after executing the commands that we put the thread back into the + // default cgroup. + { + int pid = getpid(); + SchedPolicy policy; + get_sched_policy(pid, &policy); + + if (!isTainted && policy == SP_BACKGROUND) { + LOGW("*** THREAD %p (PID %p) was left in SP_BACKGROUND with a priority of %d\n", + (void*)pthread_self(), pid, getpriority(PRIO_PROCESS, pid)); + } + } } // Let this thread exit the thread pool if it is no longer |