aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpuidle.h
diff options
context:
space:
mode:
authorDeepthi Dharwar <deepthi@linux.vnet.ibm.com>2011-10-28 06:50:09 -0400
committerLen Brown <len.brown@intel.com>2011-11-06 21:13:30 -0500
commite978aa7d7d57d04eb5f88a7507c4fb98577def77 (patch)
treed6d6dfe1dba4d4749c7eafe348351aa499c3c5eb /include/linux/cpuidle.h
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
cpuidle: Move dev->last_residency update to driver enter routine; remove dev->last_state
Cpuidle governor only suggests the state to enter using the governor->select() interface, but allows the low level driver to override the recommended state. The actual entered state may be different because of software or hardware demotion. Software demotion is done by the back-end cpuidle driver and can be accounted correctly. Current cpuidle code uses last_state field to capture the actual state entered and based on that updates the statistics for the state entered. Ideally the driver enter routine should update the counters, and it should return the state actually entered rather than the time spent there. The generic cpuidle code should simply handle where the counters live in the sysfs namespace, not updating the counters. Reference: https://lkml.org/lkml/2011/3/25/52 Signed-off-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com> Signed-off-by: Trinabh Gupta <g.trinabh@gmail.com> Tested-by: Jean Pihet <j-pihet@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Kevin Hilman <khilman@ti.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'include/linux/cpuidle.h')
-rw-r--r--include/linux/cpuidle.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
index b51629e15cfc..8da811bcdbdb 100644
--- a/include/linux/cpuidle.h
+++ b/include/linux/cpuidle.h
@@ -42,7 +42,7 @@ struct cpuidle_state {
42 unsigned long long time; /* in US */ 42 unsigned long long time; /* in US */
43 43
44 int (*enter) (struct cpuidle_device *dev, 44 int (*enter) (struct cpuidle_device *dev,
45 struct cpuidle_state *state); 45 int index);
46}; 46};
47 47
48/* Idle State Flags */ 48/* Idle State Flags */
@@ -87,13 +87,12 @@ struct cpuidle_device {
87 int state_count; 87 int state_count;
88 struct cpuidle_state states[CPUIDLE_STATE_MAX]; 88 struct cpuidle_state states[CPUIDLE_STATE_MAX];
89 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX]; 89 struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];
90 struct cpuidle_state *last_state;
91 90
92 struct list_head device_list; 91 struct list_head device_list;
93 struct kobject kobj; 92 struct kobject kobj;
94 struct completion kobj_unregister; 93 struct completion kobj_unregister;
95 void *governor_data; 94 void *governor_data;
96 struct cpuidle_state *safe_state; 95 int safe_state_index;
97 96
98 int (*prepare) (struct cpuidle_device *dev); 97 int (*prepare) (struct cpuidle_device *dev);
99}; 98};
@@ -169,7 +168,7 @@ struct cpuidle_governor {
169 void (*disable) (struct cpuidle_device *dev); 168 void (*disable) (struct cpuidle_device *dev);
170 169
171 int (*select) (struct cpuidle_device *dev); 170 int (*select) (struct cpuidle_device *dev);
172 void (*reflect) (struct cpuidle_device *dev); 171 void (*reflect) (struct cpuidle_device *dev, int index);
173 172
174 struct module *owner; 173 struct module *owner;
175}; 174};