lkml.org 
[lkml]   [2022]   [Jul]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH V6 02/16] rv: Add runtime reactors interface
From
On 7/20/22 18:41, Steven Rostedt wrote:
> On Tue, 19 Jul 2022 19:27:07 +0200
> Daniel Bristot de Oliveira <bristot@kernel.org> wrote:
>
>> +/*
>> + * reacting_on interface.
>> + */
>> +static ssize_t reacting_on_read_data(struct file *filp,
>> + char __user *user_buf,
>> + size_t count, loff_t *ppos)
>> +{
>> + char *buff;
>> +
>> + mutex_lock(&rv_interface_lock);
>> + buff = reacting_on ? "1\n" : "0\n";
>> + mutex_unlock(&rv_interface_lock);
> Again, no need for the locks, but perhaps just to keep things sane:
>
> buf = READ_ONCE(reacting_on) ? "1\n" : "0\n";

So, for all files that only read/write a single variable, use READ_ONCE/WRITE_ONCE without
locks? (and in all usage of that variable too).

-- Daniel
> -- Steve
>

\
 
 \ /
  Last update: 2022-07-20 18:51    [W:0.067 / U:1.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site