Skip to content

Commit c897c1e

Browse files
covanamrostedt
authored andcommitted
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 <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Gabriele Monaco <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Nam Cao <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 878e1e9 commit c897c1e

File tree

2 files changed

+0
-13
lines changed

2 files changed

+0
-13
lines changed

kernel/trace/rv/rv.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,8 +675,6 @@ static bool __read_mostly monitoring_on;
675675
*/
676676
bool rv_monitoring_on(void)
677677
{
678-
/* Ensures that concurrent monitors read consistent monitoring_on */
679-
smp_rmb();
680678
return READ_ONCE(monitoring_on);
681679
}
682680

@@ -696,8 +694,6 @@ static ssize_t monitoring_on_read_data(struct file *filp, char __user *user_buf,
696694
static void turn_monitoring_off(void)
697695
{
698696
WRITE_ONCE(monitoring_on, false);
699-
/* Ensures that concurrent monitors read consistent monitoring_on */
700-
smp_wmb();
701697
}
702698

703699
static void reset_all_monitors(void)
@@ -713,8 +709,6 @@ static void reset_all_monitors(void)
713709
static void turn_monitoring_on(void)
714710
{
715711
WRITE_ONCE(monitoring_on, true);
716-
/* Ensures that concurrent monitors read consistent monitoring_on */
717-
smp_wmb();
718712
}
719713

720714
static void turn_monitoring_on_with_reset(void)

kernel/trace/trace.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,6 @@ int tracing_is_enabled(void)
936936
* return the mirror variable of the state of the ring buffer.
937937
* It's a little racy, but we don't really care.
938938
*/
939-
smp_rmb();
940939
return !global_trace.buffer_disabled;
941940
}
942941

@@ -1107,8 +1106,6 @@ void tracer_tracing_on(struct trace_array *tr)
11071106
* important to be fast than accurate.
11081107
*/
11091108
tr->buffer_disabled = 0;
1110-
/* Make the flag seen by readers */
1111-
smp_wmb();
11121109
}
11131110

11141111
/**
@@ -1640,8 +1637,6 @@ void tracer_tracing_off(struct trace_array *tr)
16401637
* important to be fast than accurate.
16411638
*/
16421639
tr->buffer_disabled = 1;
1643-
/* Make the flag seen by readers */
1644-
smp_wmb();
16451640
}
16461641

16471642
/**
@@ -2710,8 +2705,6 @@ void trace_buffered_event_enable(void)
27102705

27112706
static void enable_trace_buffered_event(void *data)
27122707
{
2713-
/* Probably not needed, but do it anyway */
2714-
smp_rmb();
27152708
this_cpu_dec(trace_buffered_event_cnt);
27162709
}
27172710

0 commit comments

Comments
 (0)