RE: [PATCH] cpuidle: poll_state: Revise loop termination condition

From: Doug Smythies
Date: Sat Nov 10 2018 - 16:50:08 EST


On 2018.10.02 14:51 Rafael J. Wysocki wrote:

> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> If need_resched() returns "false", breaking out of the loop in
> poll_idle() will cause a new idle state to be selected, so in fact
> usually it doesn't make sense to spin in it longer than the target
> residency of the second state. [Note that the "polling" state is
> used only if there is at least one "real" state defined in addition
> to it.] On the other hand, breaking out of it early (say in case
> the next state is disabled) shouldn't hurt as it is polling anyway.

While I agree that it is polling anyway, this change can add significant
burden when debugging and trace is enabled for cpu_idle, if idle state 0
is used often.

For example: Phoronix dbench test, 96 clients: 900 second trace:

Kernel 4.20-rc1:
idle state 0 entry exits: 686,724
Does trace being enabled effect the system under test: Yes.

Kernel 4.20-rc1 with this patch reverted:
idle state 0 entry exits: 66,185
Does trace being enabled effect the system under test: No, or minimal.

... Doug