diff options
| author | Yucong Sun <[email protected]> | 2021-10-06 18:56:11 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2021-10-08 22:10:43 +0000 |
| commit | d719de0d2f3cbdb5890a147b90a51c5eaaef103e (patch) | |
| tree | 363c270ccc427c5772f6802454a647321dd913a3 | |
| parent | selftests/bpf: Add per worker cgroup suffix (diff) | |
| download | kernel-d719de0d2f3cbdb5890a147b90a51c5eaaef103e.tar.gz kernel-d719de0d2f3cbdb5890a147b90a51c5eaaef103e.zip | |
selftests/bpf: Fix race condition in enable_stats
In parallel execution mode, this test now need to use atomic operation
to avoid race condition.
Signed-off-by: Yucong Sun <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
| -rw-r--r-- | tools/testing/selftests/bpf/progs/test_enable_stats.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_enable_stats.c b/tools/testing/selftests/bpf/progs/test_enable_stats.c index 01a002ade529..1705097d01d7 100644 --- a/tools/testing/selftests/bpf/progs/test_enable_stats.c +++ b/tools/testing/selftests/bpf/progs/test_enable_stats.c @@ -13,6 +13,6 @@ __u64 count = 0; SEC("raw_tracepoint/sys_enter") int test_enable_stats(void *ctx) { - count += 1; + __sync_fetch_and_add(&count, 1); return 0; } |
