From: Chanwoo Choi <cw00.choi@samsung.com>
To: Kamil Konieczny <k.konieczny@samsung.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Kamil Konieczny <k.konieczny@partner.samsung.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Kyungmin Park <kyungmin.park@samsung.com>,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Marek Szyprowski <m.szyprowski@samsung.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>
Subject: Re: [PATCH 1/7] devfreq: change time stats to 64-bit
Date: Wed, 13 Nov 2019 18:44:52 +0900 [thread overview]
Message-ID: <58cf5fc7-9f57-d123-9231-243fb4f9ad66@samsung.com> (raw)
In-Reply-To: <20191113091336.5218-2-k.konieczny@samsung.com>
Hi,
On 11/13/19 6:13 PM, Kamil Konieczny wrote:
> Change time stats counting to bigger type by using 64-bit jiffies.
> This will make devfreq stats code look similar to cpufreq stats and
> prevents overflow (for HZ = 1000 after 49.7 days).
>
> Signed-off-by: Kamil Konieczny <k.konieczny@samsung.com>
> ---
> drivers/devfreq/devfreq.c | 14 +++++++-------
> include/linux/devfreq.h | 4 ++--
> 2 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index ab22bf8a12d6..1602cca20fc4 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -158,9 +158,9 @@ static int set_freq_table(struct devfreq *devfreq)
> int devfreq_update_status(struct devfreq *devfreq, unsigned long freq)
> {
> int lev, prev_lev, ret = 0;
> - unsigned long cur_time;
> + unsigned long long cur_time;
>
> - cur_time = jiffies;
> + cur_time = get_jiffies_64();
>
> /* Immediately exit if previous_freq is not initialized yet. */
> if (!devfreq->previous_freq)
> @@ -478,7 +478,7 @@ void devfreq_monitor_resume(struct devfreq *devfreq)
> queue_delayed_work(devfreq_wq, &devfreq->work,
> msecs_to_jiffies(devfreq->profile->polling_ms));
>
> - devfreq->last_stat_updated = jiffies;
> + devfreq->last_stat_updated = get_jiffies_64();
> devfreq->stop_polling = false;
>
> if (devfreq->profile->get_cur_freq &&
> @@ -698,7 +698,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
>
> devfreq->time_in_state = devm_kcalloc(&devfreq->dev,
> devfreq->profile->max_state,
> - sizeof(unsigned long),
> + sizeof(*devfreq->time_in_state),
> GFP_KERNEL);
> if (!devfreq->time_in_state) {
> mutex_unlock(&devfreq->lock);
> @@ -706,7 +706,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
> goto err_devfreq;
> }
>
> - devfreq->last_stat_updated = jiffies;
> + devfreq->last_stat_updated = get_jiffies_64();
>
> srcu_init_notifier_head(&devfreq->transition_notifier_list);
>
> @@ -1423,8 +1423,8 @@ static ssize_t trans_stat_show(struct device *dev,
> for (j = 0; j < max_state; j++)
> len += sprintf(buf + len, "%10u",
> devfreq->trans_table[(i * max_state) + j]);
> - len += sprintf(buf + len, "%10u\n",
> - jiffies_to_msecs(devfreq->time_in_state[i]));
> + len += sprintf(buf + len, "%10llu\n", (u64)
> + jiffies64_to_msecs(devfreq->time_in_state[i]));
> }
>
> len += sprintf(buf + len, "Total transition : %u\n",
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index 2bae9ed3c783..b81a86e47fb9 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -174,8 +174,8 @@ struct devfreq {
> /* information for device frequency transition */
> unsigned int total_trans;
> unsigned int *trans_table;
> - unsigned long *time_in_state;
> - unsigned long last_stat_updated;
> + u64 *time_in_state;
> + unsigned long long last_stat_updated;
>
> struct srcu_notifier_head transition_notifier_list;
> };
>
Looks good to me.
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
But, When I tried to apply it to devfreq-next branch[1],
the merge conflict happen. You need to rebase it on devfreq-next branch[1] or linux-next.git.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git/ (branch : devfreq-next)
--
Best Regards,
Chanwoo Choi
Samsung Electronics
next prev parent reply other threads:[~2019-11-13 9:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20191113091350eucas1p2545166dfa1dc3b85aee375e353d7a604@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 0/7] devfreq: improve devfreq statistics counting Kamil Konieczny
[not found] ` <CGME20191113091351eucas1p24afdb94f868b6a7a52b43e81462bb674@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 1/7] devfreq: change time stats to 64-bit Kamil Konieczny
2019-11-13 9:44 ` Chanwoo Choi [this message]
[not found] ` <CGME20191113091351eucas1p2f83c221ce94fdea695775e00d5215458@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 2/7] devfreq: protect devfreq stats data with spinlock Kamil Konieczny
2019-11-13 9:47 ` Chanwoo Choi
[not found] ` <CGME20191113091352eucas1p2c30c8a73a8362aff872e3cd9312eb24b@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 3/7] devfreq: add clearing transitions stats in sysfs Kamil Konieczny
2019-11-13 9:41 ` Chanwoo Choi
2019-11-14 18:23 ` Bartlomiej Zolnierkiewicz
2019-11-15 2:47 ` Chanwoo Choi
2019-11-15 14:35 ` Kamil Konieczny
[not found] ` <CGME20191113091352eucas1p1825d815661c1a8377449f511c65ea230@eucas1p1.samsung.com>
2019-11-13 9:13 ` [PATCH 4/7] devfreq: change var name used in time statistics Kamil Konieczny
2019-11-13 9:35 ` Chanwoo Choi
[not found] ` <CGME20191113091353eucas1p283be3173c7a9ea726b4767f9cb113f0f@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 5/7] devfreq: move transition statistics to devfreq profile structure Kamil Konieczny
2019-11-14 2:02 ` Chanwoo Choi
2019-11-14 18:10 ` Bartlomiej Zolnierkiewicz
2019-11-15 5:14 ` Chanwoo Choi
2019-11-15 14:39 ` Kamil Konieczny
[not found] ` <CGME20191113091353eucas1p2d9f82697e6ec44c0e38225988227c73c@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 6/7] devfreq: move transition statistics allocations to set_freq_stats() Kamil Konieczny
[not found] ` <CGME20191113091354eucas1p265de4985d167814f5080fbdf21b75a0a@eucas1p2.samsung.com>
2019-11-13 9:13 ` [PATCH 7/7] devfreq: move statistics to separate struct Kamil Konieczny
2019-11-14 1:52 ` Chanwoo Choi
2019-11-14 18:01 ` Bartlomiej Zolnierkiewicz
2019-11-15 3:25 ` Chanwoo Choi
2019-11-15 6:21 ` Chanwoo Choi
2019-11-15 12:40 ` Bartlomiej Zolnierkiewicz
2019-12-16 13:01 ` Lukasz Luba
2019-12-17 0:07 ` Chanwoo Choi
2019-12-17 9:10 ` Lukasz Luba
2020-01-15 15:56 ` Bartlomiej Zolnierkiewicz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58cf5fc7-9f57-d123-9231-243fb4f9ad66@samsung.com \
--to=cw00.choi@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=k.konieczny@partner.samsung.com \
--cc=k.konieczny@samsung.com \
--cc=krzk@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=myungjoo.ham@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).