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.