Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tracing: Remove pointless memory barriers

Memory barriers are useful to ensure memory accesses from one CPU appear in
the original order as seen by other CPUs.

Some smp_rmb() and smp_wmb() are used, but they are not ordering multiple
memory accesses.

Remove them.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Link: https://lore.kernel.org/20250626151940.1756398-1-namcao@linutronix.de
Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by

Nam Cao and committed by
Steven Rostedt (Google)
c897c1e5 878e1e94

-13
-6
kernel/trace/rv/rv.c
··· 675 675 */ 676 676 bool rv_monitoring_on(void) 677 677 { 678 - /* Ensures that concurrent monitors read consistent monitoring_on */ 679 - smp_rmb(); 680 678 return READ_ONCE(monitoring_on); 681 679 } 682 680 ··· 694 696 static void turn_monitoring_off(void) 695 697 { 696 698 WRITE_ONCE(monitoring_on, false); 697 - /* Ensures that concurrent monitors read consistent monitoring_on */ 698 - smp_wmb(); 699 699 } 700 700 701 701 static void reset_all_monitors(void) ··· 709 713 static void turn_monitoring_on(void) 710 714 { 711 715 WRITE_ONCE(monitoring_on, true); 712 - /* Ensures that concurrent monitors read consistent monitoring_on */ 713 - smp_wmb(); 714 716 } 715 717 716 718 static void turn_monitoring_on_with_reset(void)
-7
kernel/trace/trace.c
··· 936 936 * return the mirror variable of the state of the ring buffer. 937 937 * It's a little racy, but we don't really care. 938 938 */ 939 - smp_rmb(); 940 939 return !global_trace.buffer_disabled; 941 940 } 942 941 ··· 1106 1107 * important to be fast than accurate. 1107 1108 */ 1108 1109 tr->buffer_disabled = 0; 1109 - /* Make the flag seen by readers */ 1110 - smp_wmb(); 1111 1110 } 1112 1111 1113 1112 /** ··· 1637 1640 * important to be fast than accurate. 1638 1641 */ 1639 1642 tr->buffer_disabled = 1; 1640 - /* Make the flag seen by readers */ 1641 - smp_wmb(); 1642 1643 } 1643 1644 1644 1645 /** ··· 2705 2710 2706 2711 static void enable_trace_buffered_event(void *data) 2707 2712 { 2708 - /* Probably not needed, but do it anyway */ 2709 - smp_rmb(); 2710 2713 this_cpu_dec(trace_buffered_event_cnt); 2711 2714 } 2712 2715