Skip to content

Commit 88f7a89

Browse files
Vincent Donnefortrafaeljw
authored andcommitted
PM: EM: Extend em_perf_domain with a flag field
Merge the current "milliwatts" option into a "flag" field. This intends to prepare the extension of this structure for inefficient states support in the Energy Model. Signed-off-by: Vincent Donnefort <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent c8ed995 commit 88f7a89

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

include/linux/energy_model.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ struct em_perf_state {
4040
* struct em_perf_domain - Performance domain
4141
* @table: List of performance states, in ascending order
4242
* @nr_perf_states: Number of performance states
43-
* @milliwatts: Flag indicating the power values are in milli-Watts
44-
* or some other scale.
43+
* @flags: See "em_perf_domain flags"
4544
* @cpus: Cpumask covering the CPUs of the domain. It's here
4645
* for performance reasons to avoid potential cache
4746
* misses during energy calculations in the scheduler
@@ -56,10 +55,18 @@ struct em_perf_state {
5655
struct em_perf_domain {
5756
struct em_perf_state *table;
5857
int nr_perf_states;
59-
int milliwatts;
58+
unsigned long flags;
6059
unsigned long cpus[];
6160
};
6261

62+
/*
63+
* em_perf_domain flags:
64+
*
65+
* EM_PERF_DOMAIN_MILLIWATTS: The power values are in milli-Watts or some
66+
* other scale.
67+
*/
68+
#define EM_PERF_DOMAIN_MILLIWATTS BIT(0)
69+
6370
#define em_span_cpus(em) (to_cpumask((em)->cpus))
6471

6572
#ifdef CONFIG_ENERGY_MODEL

kernel/power/energy_model.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ DEFINE_SHOW_ATTRIBUTE(em_debug_cpus);
5656
static int em_debug_units_show(struct seq_file *s, void *unused)
5757
{
5858
struct em_perf_domain *pd = s->private;
59-
char *units = pd->milliwatts ? "milliWatts" : "bogoWatts";
59+
char *units = (pd->flags & EM_PERF_DOMAIN_MILLIWATTS) ?
60+
"milliWatts" : "bogoWatts";
6061

6162
seq_printf(s, "%s\n", units);
6263

@@ -330,7 +331,8 @@ int em_dev_register_perf_domain(struct device *dev, unsigned int nr_states,
330331
if (ret)
331332
goto unlock;
332333

333-
dev->em_pd->milliwatts = milliwatts;
334+
if (milliwatts)
335+
dev->em_pd->flags |= EM_PERF_DOMAIN_MILLIWATTS;
334336

335337
em_debug_create_pd(dev);
336338
dev_info(dev, "EM: created perf domain\n");

0 commit comments

Comments
 (0)