From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: rjw@rjwysocki.net, linux-kernel@vger.kernel.org,
Viresh Kumar <viresh.kumar@linaro.org>,
Eduardo Valentin <edubezval@gmail.com>,
Javi Merino <javi.merino@kernel.org>,
Leo Yan <leo.yan@linaro.org>,
Kevin Wangtao <kevin.wangtao@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Rui Zhang <rui.zhang@intel.com>,
Daniel Thompson <daniel.thompson@linaro.org>,
"open list:POWER MANAGEMENT CORE" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework
Date: Thu, 7 Jun 2018 10:18:27 +0200 [thread overview]
Message-ID: <ea347237-7cef-095a-5ddb-19c181d10c23@linaro.org> (raw)
In-Reply-To: <20180606150203.GE12180@hirez.programming.kicks-ass.net>
On 06/06/2018 17:02, Peter Zijlstra wrote:
> On Wed, Jun 06, 2018 at 03:42:08PM +0200, Daniel Lezcano wrote:
>> On 06/06/2018 14:23, Peter Zijlstra wrote:
>>> On Tue, Jun 05, 2018 at 11:16:40AM +0200, Daniel Lezcano wrote:
>>>> + atomic_t idle_duration_ms;
>>>> + atomic_t run_duration_ms;
>>>
>>>> + idle_duration_ms = atomic_read(&ii_dev->idle_duration_ms);
>>>
>>>> + run_duration_ms = atomic_read(&ii_dev->run_duration_ms);
>>>
>>>> + atomic_set(&ii_dev->run_duration_ms, run_duration_ms);
>>>> + atomic_set(&ii_dev->idle_duration_ms, idle_duration_ms);
>>>
>>>> + *run_duration_ms = atomic_read(&ii_dev->run_duration_ms);
>>>> + *idle_duration_ms = atomic_read(&ii_dev->idle_duration_ms);
>>>
>>>> + if (!atomic_read(&ii_dev->idle_duration_ms))
>>>
>>>> + if (!atomic_read(&ii_dev->run_duration_ms))
>>>
>>> What is the point of atomic_t here ?!
>>
>> idle_duration and run_duration can be changed from different places at
>> the same time. The atomic is here to ensure the read/write are consistent.
>>
>> Do you think it is pointless ?
>
> Yes, atomic_read() / atomic_set() are no more atomic than READ_ONCE() /
> WRITE_ONCE().
So IIUC, neither atomic or WRITE|READ_ONCE are necessary in this code
because of the wake_up_process() barrier is enough, right ?
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
next prev parent reply other threads:[~2018-06-07 8:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-05 9:16 [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework Daniel Lezcano
2018-06-05 10:39 ` Viresh Kumar
2018-06-05 14:54 ` Daniel Lezcano
2018-06-06 4:27 ` Viresh Kumar
2018-06-06 10:22 ` Daniel Lezcano
2018-06-06 10:45 ` Viresh Kumar
2018-06-06 12:05 ` Andrea Parri
2018-06-06 12:29 ` Peter Zijlstra
2018-06-07 14:11 ` Daniel Lezcano
2018-06-08 4:48 ` Viresh Kumar
2018-06-08 8:31 ` Daniel Lezcano
2018-06-06 12:23 ` Peter Zijlstra
2018-06-06 13:42 ` Daniel Lezcano
2018-06-06 15:02 ` Peter Zijlstra
2018-06-07 8:18 ` Daniel Lezcano [this message]
2018-06-07 8:32 ` Peter Zijlstra
2018-06-07 8:42 ` Viresh Kumar
2018-06-07 8:46 ` Daniel Lezcano
2018-06-07 8:49 ` Viresh Kumar
2018-06-07 9:09 ` Daniel Lezcano
2018-06-07 9:32 ` Peter Zijlstra
2018-06-07 9:39 ` Peter Zijlstra
2018-06-07 12:31 ` Daniel Lezcano
2018-06-07 9:09 ` Peter Zijlstra
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=ea347237-7cef-095a-5ddb-19c181d10c23@linaro.org \
--to=daniel.lezcano@linaro.org \
--cc=daniel.thompson@linaro.org \
--cc=edubezval@gmail.com \
--cc=javi.merino@kernel.org \
--cc=kevin.wangtao@linaro.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=rjw@rjwysocki.net \
--cc=rui.zhang@intel.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
/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