diff options
author | Ian Rogers <irogers@google.com> | 2023-01-15 00:52:51 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-01-19 19:42:06 +0300 |
commit | 1962ab6f6e0b39e4216206205bda14aff87705f3 (patch) | |
tree | c2fc06a3070b5a4956507595c00b5967eb1b89f3 /tools/perf | |
parent | 316769f75718f16e4e7d6a55d39053fe8a1d8b1c (diff) | |
download | linux-1962ab6f6e0b39e4216206205bda14aff87705f3.tar.xz |
perf test workload thloop: Make count increments atomic
The count variable is incremented by multiple threads, doing so
without an atomic operation causes thread sanitizer warnings. Switch
to using relaxed atomics.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20230114215251.271678-1-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/tests/workloads/thloop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/tests/workloads/thloop.c b/tools/perf/tests/workloads/thloop.c index 29193b75717e..af05269c2eb8 100644 --- a/tools/perf/tests/workloads/thloop.c +++ b/tools/perf/tests/workloads/thloop.c @@ -20,7 +20,7 @@ static void sighandler(int sig __maybe_unused) noinline void test_loop(void) { while (!done) - count++; + __atomic_fetch_add(&count, 1, __ATOMIC_RELAXED); } static void *thfunc(void *arg) |