lkml.org 
[lkml]   [2018]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH V5] powercap/drivers/idle_injection: Add an idle injection framework
From
Date
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 ?




--
<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

\
 
 \ /
  Last update: 2018-06-06 15:43    [W:0.086 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site