]> git.baikalelectronics.ru Git - kernel.git/commit
ring-buffer: Remove duplicate use of '&' in recursive code
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Fri, 27 Mar 2015 21:39:49 +0000 (17:39 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Mon, 30 Mar 2015 17:36:31 +0000 (13:36 -0400)
commit8a642919c73aa4779ddf51a107729cd19c197313
tree7a213ad0e5ede27961a63eb97bbc361309c4a599
parent58b6ce54d30e3e45da41a6dd8a2522cb83a54c32
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.

And Christoph even mentioned that it can be further compacted to
just a single line:

  __this_cpu_and(current_context, __this_cpu_read(current_context) - 1);

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>
kernel/trace/ring_buffer.c