Re: [PATCH v2 3/3] PM / EM: Skip inefficient OPPs

From: Quentin Perret
Date: Tue May 25 2021 - 09:07:04 EST


Hi Lukasz,

On Tuesday 25 May 2021 at 12:03:14 (+0100), Lukasz Luba wrote:
> That's a few more instructions to parse the 'flags' filed. I'm not sure
> if that brings speed improvements vs. if we not parse and have bool
> filed with a simple looping. The out-of-order core might even suffer
> from this parsing and loop index manipulations...

I'm not sure what you mean about parsing here? I'm basically suggesting
to do something along the lines of:

diff --git a/include/linux/energy_model.h b/include/linux/energy_model.h
index daaeccfb9d6e..f02de32d2325 100644
--- a/include/linux/energy_model.h
+++ b/include/linux/energy_model.h
@@ -128,13 +128,11 @@ struct em_perf_state *em_pd_get_efficient_state(struct em_perf_domain *pd,

for (i = 0; i < pd->nr_perf_states; i++) {
ps = &pd->table[i];
- if (ps->flags & EM_PERF_STATE_INEFFICIENT)
- continue;
if (ps->frequency >= freq)
break;
}

- return ps;
+ return &pd->table[ps->next_efficient_idx];
}

What would be wrong with that?

Thanks,
Quentin