kernel - Optimize idle thread halt
* Count the number of times the idle thread is entered on a cpu without
switching to a non-idle thread. Use the fast-halt (non-ACPI) until the
count exceeds a reasonable machdep.cpu_idle_repeat.
This improves the default performance to levels closer to cpu_idle_hlt
mode 1 but still gives us the power savings from mode 3. Performanced is
improved significantly because many threads on SMP boxes are event
or pipe oriented and only sleep for short periods of time or ping-pong
back and forth. For example, a cc -pipe, or typical kernel threads
blocking on tokens or locks for short periods of time.
* Adjust machdep.cpu_idle_hlt modes:
0 Never halt, the idle thread just spins.
1 Always use a fast HLT/MONITOR/MWAIT
2 Hybrid approach use (1) up to a certain point, then use (3).
(this is the default)
3 Always use the ACPI halt