From: Rafael J. Wysocki Date: Thu, 10 Oct 2019 21:32:17 +0000 (+0200) Subject: cpuidle: teo: Ignore disabled idle states that are too deep X-Git-Tag: v5.5-rc1~147^2~4^2~10^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=069ce2ef1a6dd84cbd4d897b333e30f825e021f0;p=thirdparty%2Fkernel%2Flinux.git cpuidle: teo: Ignore disabled idle states that are too deep Prevent disabled CPU idle state with target residencies beyond the anticipated idle duration from being taken into account by the TEO governor. Fixes: b26bf6ab716f ("cpuidle: New timer events oriented governor for tickless systems") Signed-off-by: Rafael J. Wysocki Cc: 5.1+ # 5.1+ --- diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c index b5a0e498f7989..8806db95a9138 100644 --- a/drivers/cpuidle/governors/teo.c +++ b/drivers/cpuidle/governors/teo.c @@ -257,6 +257,13 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, struct cpuidle_state_usage *su = &dev->states_usage[i]; if (s->disabled || su->disable) { + /* + * Ignore disabled states with target residencies beyond + * the anticipated idle duration. + */ + if (s->target_residency > duration_us) + continue; + /* * If the "early hits" metric of a disabled state is * greater than the current maximum, it should be taken