mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Christoph Lameter <cl@linux.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	stable@vger.kernel.org,
	Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Subject: [PATCH] ring-buffer: Remove duplicate use of '&' in recursive code
Date: Fri, 27 Mar 2015 17:50:33 -0400	[thread overview]
Message-ID: <20150327175033.66ca3553@gandalf.local.home> (raw)
In-Reply-To: <alpine.DEB.2.11.1503271423580.23114@gentwo.org>


Steven Rostedt (Red Hat) (1):
      ring-buffer: Remove duplicate use of '&' in recursive code

----
 kernel/trace/ring_buffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---------------------------
commit 7eb867195b9f3990da60738b1f26d0a71f37f77f
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Fri Mar 27 17:39:49 2015 -0400

    ring-buffer: Remove duplicate use of '&' in recursive code
    
    A clean up of the recursive protection code changed
    
      val = this_cpu_read(current_context);
      val--;
      val &= this_cpu_read(current_context);
    
    to
    
      val = this_cpu_read(current_context);
      val &= val & (val - 1);
    
    Which has a duplicate use of '&' as the above is the same as
    
      val = val & (val - 1);
    
    Actually, it would be best to remove that line altogether and
    just add it to where it is used.
    
    Link: http://lkml.kernel.org/alpine.DEB.2.11.1503271423580.23114@gentwo.org
    
    Suggested-by: Christoph Lameter <cl@linux.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 922048a0f7ea..93caf56567cb 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2705,8 +2705,7 @@ static __always_inline void trace_recursive_unlock(void)
 {
 	unsigned int val = __this_cpu_read(current_context);
 
-	val &= val & (val - 1);
-	__this_cpu_write(current_context, val);
+	__this_cpu_write(current_context, val & (val - 1));
 }
 
 #else

  parent reply	other threads:[~2015-03-27 21:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 13:00 [for-next][PATCH 0/4] tracing: updates for 4.1 Steven Rostedt
2015-03-25 13:00 ` [for-next][PATCH 1/4] ring-buffer: Replace this_cpu_*() with __this_cpu_*() Steven Rostedt
2015-03-27 19:41   ` Christoph Lameter
2015-03-27 20:11     ` Steven Rostedt
2015-03-30 12:44       ` Christoph Lameter
2015-03-30 13:37         ` Steven Rostedt
2015-03-30 14:32           ` Christoph Lameter
2015-03-27 21:50     ` Steven Rostedt [this message]
2015-03-25 13:00 ` [for-next][PATCH 2/4] tracing: %pF is only for function pointers Steven Rostedt
2015-03-25 13:00 ` [for-next][PATCH 3/4] tracing: remove ftrace:function TRACE_EVENT_FL_USE_CALL_FILTER flag Steven Rostedt
2015-03-25 13:00 ` [for-next][PATCH 4/4] trace: Dont use __weak in header files Steven Rostedt

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=20150327175033.66ca3553@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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

all inboxes | Powered by JetHome®