Commit 075e4807 authored by Alexander Motin's avatar Alexander Motin
Browse files

Do not read timer extra time when MWAIT is used.

When we enter C2+ state via memory read, it may take chipset some
time to stop CPU.  Extra register read covers that time.  But MWAIT
makes CPU stop immediately, so we don't need to waste time after
wakeup with interrupts still disabled, increasing latency.

On my system it reduces ping localhost latency, waking up all CPUs
once a second, from 277us to 242us.

MFC after:	1 month
parent 45521967
......@@ -1220,18 +1220,19 @@ acpi_cpu_idle(sbintime_t sbt)
start_time = 0;
cputicks = cpu_ticks();
}
if (cx_next->do_mwait)
if (cx_next->do_mwait) {
acpi_cpu_idle_mwait(cx_next->mwait_hint);
else
} else {
CPU_GET_REG(cx_next->p_lvlx, 1);
/*
* Read the end time twice. Since it may take an arbitrary time
* to enter the idle state, the first read may be executed before
* the processor has stopped. Doing it again provides enough
* margin that we are certain to have a correct value.
*/
AcpiGetTimer(&end_time);
}
/*
* Read the end time twice. Since it may take an arbitrary time
* to enter the idle state, the first read may be executed before
* the processor has stopped. Doing it again provides enough
* margin that we are certain to have a correct value.
*/
AcpiGetTimer(&end_time);
if (cx_next->type == ACPI_STATE_C3) {
AcpiGetTimer(&end_time);
AcpiGetTimerDuration(start_time, end_time, &end_time);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment