Skip to content

cpufreq: Use sorted frequency tables

Viresh Kumar linux-pm lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 4 repliesIn review
  2. v12 patches 10 repliesSuperseded

Changes in v2 from the cover letter

- This optimizes cpufreq_frequency_table_target() instead of new APIs.
- Is rebased over bleeding-edge + following cleanup series. [PATCH 0/8] cpufreq: cleanups and reorganization

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2cpufreq: Store sorted frequency tabledrivers/cpufreq/cpufreq.c drivers/cpufreq/freq_table.c include/linux/cpufreq.h+86 -70 replies
2/2cpufreq: Optimize cpufreq_frequency_table_target()drivers/cpufreq/acpi-cpufreq.c drivers/cpufreq/freq_table.c drivers/cpufreq/s3c24xx-cpufreq.c +1 more+134 -944 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH V2 0/2] cpufreq: Use sorted frequency tables

Hi Guys,

This work in inspired by some of the concerns raised by Steve in one of his patchset.

Currently, the cpufreq drivers aren't required to provide a sorted list of frequencies to the cpufreq-core and so traversing that list match a target frequency is very inefficient.

This is not bearable by, for example, the fast-switch path of schedutil governor and so we have moved the traversing logic local to the acpi-cpufreq driver for now. That is better handled in the core, but it has to be efficient first.

OTOH, even for traditional governors without a fast-switch path, it would be much better to be able to traverse this table quickly.

The ideal solution would be to keep a single *sorted* freq-table in struct cpufreq_policy. But there are few dependencies due to which it can't be done today (Hint: cpufreq drivers are abusing the 'index' passed to them, to refer to multiple arrays).

And so for now, lets create a separate table local to the cpufreq-core *only*.

This modifies the existing API cpufreq_frequency_table_target() to use the sorted table.

Lightly tested on Exynos board, frequencies were getting selected as expected.

V1->V2:
- This optimizes cpufreq_frequency_table_target() instead of new APIs.
- Is rebased over bleeding-edge + following cleanup series. [PATCH 0/8] cpufreq: cleanups and reorganization

--
viresh

Viresh Kumar (2):
cpufreq: Store sorted frequency table
cpufreq: Optimize cpufreq_frequency_table_target()

 drivers/cpufreq/acpi-cpufreq.c    |  15 +--
 drivers/cpufreq/cpufreq.c         |  23 ++--
 drivers/cpufreq/freq_table.c      | 247 ++++++++++++++++++++++++++------------
 drivers/cpufreq/s3c24xx-cpufreq.c |  13 +-
 include/linux/cpufreq.h           |  23 +++-
 5 files changed, 220 insertions(+), 101 deletions(-)
Signature · 1 line
2.7.1.410.g6faf27b