Re: [PATCH bpf-next] bpf: add lookup_and_delete_elem support to hashtab
From: Andrii Nakryiko <hidden>
Date: 2021-02-09 05:46:08
On Wed, Jan 27, 2021 at 9:15 AM Denis Salopek [off-list ref] wrote:
Extend the existing bpf_map_lookup_and_delete_elem() functionality to hashtab maps, in addition to stacks and queues. Create a new hashtab bpf_map_ops function that does lookup and deletion of the element under the same bucket lock and add the created map_ops to bpf.h. Add the appropriate test case to 'maps' selftests. Signed-off-by: Denis Salopek <redacted> Cc: Juraj Vijtiuk <redacted> Cc: Luka Oreskovic <redacted> Cc: Luka Perkov <luka.perkov@sartura.hr> ---
I think this patch somehow got lost, even though it seems like a good addition. I'd recommend rebasing and re-submitting to let people take a fresh look at this. It would also be nice to have a test_progs test added, not just test_maps. I'd also look at supporting lookup_and_delete for other kinds of hash maps (LRU, per-CPU), so that the support is more complete. Thanks!
include/linux/bpf.h | 1 + kernel/bpf/hashtab.c | 38 +++++++++++++++++++++++++ kernel/bpf/syscall.c | 9 ++++++ tools/testing/selftests/bpf/test_maps.c | 7 +++++ 4 files changed, 55 insertions(+)
[...]