lkml.org 
[lkml]   [2015]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] ring-buffer: Replace this_cpu_*() with __this_cpu_*()
On Tue, 17 Mar 2015 15:47:01 +0100
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> Guten Morgen Steven,
>
> On Tue, Mar 17, 2015 at 10:40:38AM -0400, Steven Rostedt wrote:
> > static __always_inline void trace_recursive_unlock(void)
> > {
> > - unsigned int val = this_cpu_read(current_context);
> > + unsigned int val = __this_cpu_read(current_context);
> > + unsigned int val2;
> >
> > - val--;
> > - val &= this_cpu_read(current_context);
> > - this_cpu_write(current_context, val);
> > + val2 = val - 1;
> > + val &= val2;
> > + __this_cpu_write(current_context, val);
> You could use:
>
> unsigned int val = __this_cpu_read(current_context);
>
> val = val & (val - 1);
>
> __this_cpu_write(current_context, val);
>
> and save a few lines and still make it more readable (IMHO).

Me too. My version came from looking at too much assembly, and val2
just happened to be another register in my mind.

>
> BTW, this patch makes the additional lines in the trace disappear, so if
> you think that makes a Tested-by applicable, feel free to add it.

OK, will do. Thanks.

Christoph, you happy with this version?

-- Steve



\
 
 \ /
  Last update: 2015-03-17 16:21    [W:0.443 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site