ring_buffer: Use try_cmpxchg instead of cmpxchg in rb_insert_pages
authorUros Bizjak <ubizjak@gmail.com>
Thu, 14 Sep 2023 16:34:02 +0000 (18:34 +0200)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 4 Oct 2023 01:44:38 +0000 (21:44 -0400)
commitbdf4fb628093b4ab2f4eb312256233a2ae0594b7
tree2935e2509d51097ed3eb9be16b1038f60f0a0049
parenta1f157c7a3bb342b972c2830a0ad53f627000a04
ring_buffer: Use try_cmpxchg instead of cmpxchg in rb_insert_pages

Use try_cmpxchg instead of cmpxchg (*ptr, old, new) == old in
rb_insert_pages. x86 CMPXCHG instruction returns success in ZF flag,
so this change saves a compare after cmpxchg (and related move
instruction in front of cmpxchg).

No functional change intended.

Link: https://lore.kernel.org/linux-trace-kernel/20230914163420.12923-1-ubizjak@gmail.com
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c