[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea347237-7cef-095a-5ddb-19c181d10c23@linaro.org>
Date: Thu, 7 Jun 2018 10:18:27 +0200
From: Daniel Lezcano <daniel.lezcano@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: rjw@...ysocki.net, linux-kernel@...r.kernel.org,
Viresh Kumar <viresh.kumar@...aro.org>,
Eduardo Valentin <edubezval@...il.com>,
Javi Merino <javi.merino@...nel.org>,
Leo Yan <leo.yan@...aro.org>,
Kevin Wangtao <kevin.wangtao@...aro.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
Rui Zhang <rui.zhang@...el.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
"open list:POWER MANAGEMENT CORE" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection
framework
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
Powered by blists - more mailing lists