public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ring-buffer: Replace this_cpu_*() with __this_cpu_*()
Date: Tue, 17 Mar 2015 15:47:01 +0100	[thread overview]
Message-ID: <20150317144701.GJ10068@pengutronix.de> (raw)
In-Reply-To: <20150317104038.312e73d1@gandalf.local.home>

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

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.

Best regards
Uwe
-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2015-03-17 14:47 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 [this message]
2015-03-17 15:07           ` Steven Rostedt
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=20150317144701.GJ10068@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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