mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-23 14:24:25 +08:00
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 <sunyucong@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211006185619.364369-7-fallentree@fb.com
This commit is contained in:
parent
e87c3434f8
commit
d719de0d2f
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user