Messages in this thread Patch in this message |  | | Date | Sat, 14 Jan 2023 13:52:51 -0800 | Subject | [PATCH v1] perf test workload thloop: Make count increments atomic | From | Ian Rogers <> |
| |
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> --- tools/perf/tests/workloads/thloop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
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) -- 2.39.0.314.g84b9a713c41-goog
|  |