提交 d719de0d 编写于 作者: Y Yucong Sun 提交者: Andrii Nakryiko

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: NYucong Sun <sunyucong@gmail.com>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211006185619.364369-7-fallentree@fb.com
上级 e87c3434
......@@ -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;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册