Hi, The motivation for the patch set comes from the question raised by Cody Haas [1]. He asked whether or not the update of htab of map is atomic in the perspective of lookup operation. Currently, the update is not atomic because the overwrite of existing element happens in a two-steps way, but the support of atomic update is feasible. Initiallly, I only plan to support atomic update for htab of map because array of map has already supported that. Afterwards, I think it may be reasonable to support atomic update for all kinds of hash map. However, for the BPF_F_LOCK case, although the update is protected by a spin-lock, the update is still not atomic in the perspective of the lookup operation. Please see individual patches for details. Comments are always welcome. --- [1] : https://lore.kernel.org/xdp-newbies/07a365d8-2e66-2899-4298-b8b158a928fa@xxxxxxxxxxxxxxx/T/#m06fcd687c6cfdbd0f9b643b227e69b479fc8c2f6 Hou Tao (3): rculist: add hlist_nulls_replace_rcu() helper bpf: Overwrite the element in hash map atomically selftests/bpf: Add test case for atomic htab update include/linux/rculist_nulls.h | 42 ++++++ kernel/bpf/hashtab.c | 14 +- .../selftests/bpf/prog_tests/htab_lookup.c | 130 ++++++++++++++++++ .../testing/selftests/bpf/progs/htab_lookup.c | 13 ++ 4 files changed, 193 insertions(+), 6 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/htab_lookup.c create mode 100644 tools/testing/selftests/bpf/progs/htab_lookup.c -- 2.48.1