OSDN Git Service

Switch thread's cgroup during spin-on-suspend.
authorAndy McFadden <fadden@android.com>
Tue, 2 Mar 2010 22:23:04 +0000 (14:23 -0800)
committerAndy McFadden <fadden@android.com>
Tue, 2 Mar 2010 22:45:24 +0000 (14:45 -0800)
commitd2afbcf85012252754d0e9c8b0084842fcab22fa
tree6a7273fd4cc2059b280870895c62296aac0c3976
parent10ebc7d0b84dcb98e1a7eeac96ef06acdfc8d184
Switch thread's cgroup during spin-on-suspend.

Dalvik uses a safe-point suspend mechanism, in which threads are asked
to suspend and do so at their earliest convenience.  The thread doing
the asking will sleep-spin until all threads have complied.  If a thread
keeps on running, we get a "spin on suspend" situation.

The VM tries to correct matters by raising the priority of the spinning
thread if it's below normal.  Until now it was just fiddling with the
"nice" value, but it appears that isn't enough (e.g. bug 2467653).  We
now also change the thread's process group from "background" to
"foreground" in an attempt to get it some CPU.

Also includes some changes as part of the Log Reduction Act:

- Don't log the thread stacks on the first spin-on-suspend iteration.
  The act of logging can itself be quite a drag.
- Removed the redundant and unnecessary "dumping state" line, as well
  as some dead glibc-only code.
- While waiting for daemon threads to shut down, only show the "not
  ready yet" message on the first iteration.
vm/Thread.c