diff options
author | 2023-08-18 09:50:00 +0000 | |
---|---|---|
committer | 2023-08-21 20:57:30 +0200 | |
commit | ed9571647eff3dd7a53068f83338530959c7ace4 (patch) | |
tree | bd99cd42e483e6d12246441c72b2c3187fc7256a /drivers/cpufreq/Makefile | |
parent | Linux 6.5-rc7 (diff) | |
download | linux-ed9571647eff3dd7a53068f83338530959c7ace4.tar.gz linux-ed9571647eff3dd7a53068f83338530959c7ace4.tar.bz2 linux-ed9571647eff3dd7a53068f83338530959c7ace4.zip |
cpufreq: stats: Improve the performance of cpufreq_stats_create_table()
In the worst case, the freq_table of policy data is not sorted and
contains duplicate frequencies, this means that it needs to iterate
through the entire freq_table of policy to ensure each frequency is
unique in the freq_table of stats data, this has a time complexity of
O(N^2), where N is the number of frequencies in the freq_table of
policy.
However, if the policy.freq_table is already sorted and contains no
duplicate frequencies, it can reduce the time complexity of creating
stats.freq_table to O(N), the 'freq_table_sorted' field of policy data
can be used to indicate whether the policy.freq_table is sorted.
Signed-off-by: Liao Chang <liaochang1@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
[ rjw: Fix typo in changelog, remove redundant parens ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/Makefile')
0 files changed, 0 insertions, 0 deletions