12
12
13
13
/**
14
14
* em_perf_state - Performance state of a performance domain
15
- * @frequency: The CPU frequency in KHz, for consistency with CPUFreq
16
- * @power: The power consumed by 1 CPU at this level, in milli-watts
15
+ * @frequency: The frequency in KHz, for consistency with CPUFreq
16
+ * @power: The power consumed at this level, in milli-watts (by 1 CPU or
17
+ by a registered device). It can be a total power: static and
18
+ dynamic.
17
19
* @cost: The cost coefficient associated with this level, used during
18
20
* energy calculation. Equal to: power * max_frequency / frequency
19
21
*/
@@ -27,12 +29,16 @@ struct em_perf_state {
27
29
* em_perf_domain - Performance domain
28
30
* @table: List of performance states, in ascending order
29
31
* @nr_perf_states: Number of performance states
30
- * @cpus: Cpumask covering the CPUs of the domain
32
+ * @cpus: Cpumask covering the CPUs of the domain. It's here
33
+ * for performance reasons to avoid potential cache
34
+ * misses during energy calculations in the scheduler
35
+ * and simplifies allocating/freeing that memory region.
31
36
*
32
- * A "performance domain" represents a group of CPUs whose performance is
33
- * scaled together. All CPUs of a performance domain must have the same
34
- * micro-architecture. Performance domains often have a 1-to-1 mapping with
35
- * CPUFreq policies.
37
+ * In case of CPU device, a "performance domain" represents a group of CPUs
38
+ * whose performance is scaled together. All CPUs of a performance domain
39
+ * must have the same micro-architecture. Performance domains often have
40
+ * a 1-to-1 mapping with CPUFreq policies. In case of other devices the @cpus
41
+ * field is unused.
36
42
*/
37
43
struct em_perf_domain {
38
44
struct em_perf_state * table ;
@@ -71,10 +77,12 @@ struct em_data_callback {
71
77
#define EM_DATA_CB (_active_power_cb ) { .active_power = &_active_power_cb }
72
78
73
79
struct em_perf_domain * em_cpu_get (int cpu );
80
+ struct em_perf_domain * em_pd_get (struct device * dev );
74
81
int em_register_perf_domain (cpumask_t * span , unsigned int nr_states ,
75
82
struct em_data_callback * cb );
76
83
int em_dev_register_perf_domain (struct device * dev , unsigned int nr_states ,
77
84
struct em_data_callback * cb , cpumask_t * span );
85
+ void em_dev_unregister_perf_domain (struct device * dev );
78
86
79
87
/**
80
88
* em_pd_energy() - Estimates the energy consumed by the CPUs of a perf. domain
@@ -184,10 +192,17 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
184
192
{
185
193
return - EINVAL ;
186
194
}
195
+ static inline void em_dev_unregister_perf_domain (struct device * dev )
196
+ {
197
+ }
187
198
static inline struct em_perf_domain * em_cpu_get (int cpu )
188
199
{
189
200
return NULL ;
190
201
}
202
+ static inline struct em_perf_domain * em_pd_get (struct device * dev )
203
+ {
204
+ return NULL ;
205
+ }
191
206
static inline unsigned long em_pd_energy (struct em_perf_domain * pd ,
192
207
unsigned long max_util , unsigned long sum_util )
193
208
{
0 commit comments