lkml.org 
[lkml]   [2015]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] ring-buffer: Remove duplicate use of '&' in recursive code

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

\
 
 \ /
  Last update: 2015-03-27 23:01    [W:0.231 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site