diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2015-03-27 17:39:49 -0400 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-06-06 19:11:04 -0400 |
commit | 090243482940087932c879868ca3b676a6701075 (patch) | |
tree | 7f73ce8c897f6d2104cfb83a8336bf479c8d8067 /kernel | |
parent | 4baf9733a655b71db7b436484dfdc04566c3a5a3 (diff) |
ring-buffer: Remove duplicate use of '&' in recursive code
[ Upstream commit d631c8cceb1d1d06f372878935949d421585186b ]
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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ring_buffer.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 0b6b66720e2b..53ffcf53fcd7 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2708,10 +2708,7 @@ static __always_inline int trace_recursive_lock(void) 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_and(current_context, __this_cpu_read(current_context) - 1); } #else |