public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: rostedt@goodmis.org (Steven Rostedt)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ring-buffer: Replace this_cpu_*() with __this_cpu_*()
Date: Tue, 17 Mar 2015 11:07:50 -0400	[thread overview]
Message-ID: <20150317110750.2a0e2b73@gandalf.local.home> (raw)
In-Reply-To: <20150317144701.GJ10068@pengutronix.de>

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

  reply	other threads:[~2015-03-17 15:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 21:31 [RFC][PATCH] ring-buffer: Replace this_cpu_{read,write} with this_cpu_ptr() Steven Rostedt
2015-03-17  5:56 ` Christoph Lameter
2015-03-17 12:13   ` Steven Rostedt
2015-03-17 14:11     ` Steven Rostedt
2015-03-17 14:40       ` [PATCH v2] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Steven Rostedt
2015-03-17 14:47         ` Uwe Kleine-König
2015-03-17 15:07           ` Steven Rostedt [this message]
2015-03-19 16:20             ` Christoph Lameter
2015-03-19 16:31               ` Steven Rostedt
2015-03-19 16:33               ` Christoph Lameter
2015-03-19 16:40                 ` Steven Rostedt
2015-03-24 18:49                   ` Christoph Lameter
2015-03-19 16:19       ` [RFC][PATCH] ring-buffer: Replace this_cpu_{read,write} with this_cpu_ptr() Christoph Lameter

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=20150317110750.2a0e2b73@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-arm-kernel@lists.infradead.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