]> err.no Git - linux-2.6/commitdiff
cpuidle: Make ladder governor honor latency requirements fully
authorvenkatesh.pallipadi@intel.com <venkatesh.pallipadi@intel.com>
Thu, 31 Jul 2008 02:21:44 +0000 (19:21 -0700)
committerAndi Kleen <ak@linux.intel.com>
Fri, 15 Aug 2008 19:25:35 +0000 (21:25 +0200)
ladder governor only honored latency requirement when promoting C-states.
Instead. it should check for latency requirement on each idle call,
and demote to appropriate C-state when there is a latency requirement change.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/cpuidle/governors/ladder.c

index 27ab3bfe375b60f66c045c274aeb76c144ae262c..a4bec3f919aa7cb98ddaf8f6f7121dc4d2f4781a 100644 (file)
@@ -98,6 +98,18 @@ static int ladder_select_state(struct cpuidle_device *dev)
        }
 
        /* consider demotion */
+       if (last_idx > CPUIDLE_DRIVER_STATE_START &&
+           dev->states[last_idx].exit_latency > latency_req) {
+               int i;
+
+               for (i = last_idx - 1; i > CPUIDLE_DRIVER_STATE_START; i--) {
+                       if (dev->states[i].exit_latency <= latency_req)
+                               break;
+               }
+               ladder_do_selection(ldev, last_idx, i);
+               return i;
+       }
+
        if (last_idx > CPUIDLE_DRIVER_STATE_START &&
            last_residency < last_state->threshold.demotion_time) {
                last_state->stats.demotion_count++;