Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1735175
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int |
| Date | 2017-09-19 21:00 +0200 |
| Message-ID | <urvUt-AH-5@gated-at.bofh.it> (permalink) |
| References | <uq5fH-7Tu-3@gated-at.bofh.it> <uqTvP-7Fn-7@gated-at.bofh.it> <ur8lc-TR-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 18-09-17, 10:39, Bo Yan wrote:
> Currently, the "last_index" is being checked before
> cpufreq_stats_update(stats) inside function
> "cpufreq_stats_record_transition", so it's taken care of.
>
> However, the function "show_time_in_state" also calls cpufreq_stats_update,
> the similar check should be done there too, like this:
Yeah, that's what I suggested.
> diff --git a/drivers/cpufreq/cpufreq_stats.c
> b/drivers/cpufreq/cpufreq_stats.c
> index e75880eb037d..15305b5ec322 100644
> --- a/drivers/cpufreq/cpufreq_stats.c
> +++ b/drivers/cpufreq/cpufreq_stats.c
> @@ -62,7 +62,8 @@ static ssize_t show_time_in_state(struct cpufreq_policy
> *policy, char *buf)
> if (policy->fast_switch_enabled)
> return 0;
>
> - cpufreq_stats_update(stats);
> + if ((int)stats->last_index >= 0)
You can rather do:
if (stats->last_index != -1)
> + cpufreq_stats_update(stats);
> for (i = 0; i < stats->state_num; i++) {
> len += sprintf(buf + len, "%u %llu\n", stats->freq_table[i],
> (unsigned long long)
>
>
> This is only needed when policy->cur is not in frequency table when stats
> table is created, in which case, stats->last_index will get -1, then user
> does a "cat time_in_state" before any frequency transition.
>
> Does this make sense?
--
viresh
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] cpufreq: cpufreq_stats: make last_index signed int Bo Yan <byan@nvidia.com> - 2017-09-15 22:20 +0200
Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int Viresh Kumar <viresh.kumar@linaro.org> - 2017-09-18 04:00 +0200
Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int Bo Yan <byan@nvidia.com> - 2017-09-18 19:50 +0200
Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int Viresh Kumar <viresh.kumar@linaro.org> - 2017-09-19 21:00 +0200
csiph-web