Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1735175
| Path | csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Viresh Kumar <viresh.kumar@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] cpufreq: cpufreq_stats: make last_index signed int |
| Date | Tue, 19 Sep 2017 21:00:01 +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> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=km98gbFV5QFtKOdu6gYX3u6ziJtANxPLfQ+GsXcSGw0=; b=Lrpu74wm6KLD8qPdImgGDM9eTNlzDedKrLv4wat0SxKn2A6+H70Gv4kztkwr4BC838 crS6x40o6RIuD7s1kd1IyVrpOYn494CZom1vsFG+1M3+f1K6tHDBwjWJqKt8lSdTUV8n bV+4x8KE7i2XdLxNWbnghntKcOZBwSyC/eS34= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=km98gbFV5QFtKOdu6gYX3u6ziJtANxPLfQ+GsXcSGw0=; b=JxNSSVVCoRP7mdV33RiITO/CpBcNfr50ITFLYPk3X3skTAeUhg8zf8ztX/EISyHX7A hwahb3aMG5yjjurlQ6vG2xmxnuJb/OXJI+66/wcXkEiHHRLJ353AKUunECiyiXr3rZi4 eMrokYYMQ2hBinrd1Cdq2ZUUNHWc4SeAweVGGWjKcJurRGjj2lbfvIXw7Urc+izqkZ+E 19AFlDM8ViOryQIRoIjNmrzCHXouOuf4+DDaCrLO/H/AZbXHowVNmQl1fDkb7dIbG2mG Fl3N9MvQhBVBbmUUuQnRY0CNLwbXxPPSnDmkz0J5vjQgGOBfLWCdZw4lFL8wSgZW2LqA boww== |
| X-Gm-Message-State | AHPjjUjgST1fC2F4y7UF6g3tt5N9hY0vWfCuOYtTYvkAKZ/zSLJqTy77 TjEHasKXy9epwqXCH7ukdhv7zQ== |
| X-Google-SMTP-Source | AOwi7QCIV/OVIDwQ+vbpBBYV89cgDK8AguL3rJwUwiDS4QPOGKGN+FrfKnFWD4nOsI6+JVruDjjKEw== |
| X-Received | by 10.98.35.209 with SMTP id q78mr2261735pfj.36.1505847292543; Tue, 19 Sep 2017 11:54:52 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.24 (2015-08-30) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 41 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Tue, 19 Sep 2017 11:54:47 -0700 |
| X-Original-Message-ID | <20170919185447.GC30848@ubuntu> |
| X-Original-References | <1505506402-11497-1-git-send-email-byan@nvidia.com> <20170918015017.GC17030@ubuntu> <961bce0a-5162-5e8d-3474-5b2161cf92c4@nvidia.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1735175 |
Show key headers only | View raw
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