|
Description
|
Currently, idle CPUS use the "halt' instruction to "sleep" to both save power and minimally impact the performance of other CPUs on the same pipeline, chip, etc.
On processors that support it, a lighter weight monitor/mwait based implementation could yield similar power savings benefits as halt, but with better performance (since the xcall to "wakeup" the halted CPU wouldn't be necessary).
Such an implementation should be implemented/evaluated for processors that support it.
wx tpdiffs and Webrev is attached.
See attached "benchmark" cv_token.c. This user-land program has a 6% to 16%
performance improvement on the mwait enabled Solaris kernel on a 2-socket
Core 2 Duo and a 2-socket XEON. This program is a modified "dining philosophers".
It creates a bound thread per cpu and a mutex/condition-variable per cpu.
Each thread sleeps on its own condition variable. When a thread wakes up,
it selects a target cpu, cv_signals the target, and then waits on its cv.
cpu order can be specified.
The suggested fix queries the cpuid instruction in OS initialization to
determine if monitor/mwait is available on this processor and the size to use.
During Solaris startup proper size/aligned buffers are allocated for monitor/
mwait. If mwait is used idle_cpu is set pointing to idle_cpu_mwait and
disp_enq_thread is pointed at cpu_wakeup_mwait.
This fix does not include deaper C-states.
|