cpuidle: teo: Ignore disabled idle states that are too deep
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 10 Oct 2019 21:32:17 +0000 (23:32 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 14 Oct 2019 08:40:32 +0000 (10:40 +0200)
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 <rafael.j.wysocki@intel.com>
Cc: 5.1+ <stable@vger.kernel.org> # 5.1+
drivers/cpuidle/governors/teo.c

index b5a0e49..8806db9 100644 (file)
@@ -258,6 +258,13 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
 
                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
                         * into account, because it would be a mistake to select