Re: [PATCH RFC bpf-next v2 11/18] libbpf: Support resizable hashtable

Emil Tsalapatis
2026-04-14T17:46:21Z

On Wed Apr 8, 2026 at 11:10 AM EDT, Mykyta Yatsenko wrote:
> From: Mykyta Yatsenko <yatsenko@meta.com>
>
> Add BPF_MAP_TYPE_RHASH to libbpf's map type name table and feature
> probing so that libbpf-based tools can create and identify resizable
> hash maps.
>
> Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>

> ---
> tools/lib/bpf/libbpf.c | 1 +
> tools/lib/bpf/libbpf_probes.c | 3 +++
> 2 files changed, 4 insertions(+)
>
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 9ea41f40dc82..a0324e5b6085 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -192,6 +192,7 @@ static const char * const map_type_name[] = {
> [BPF_MAP_TYPE_CGRP_STORAGE] = "cgrp_storage",
> [BPF_MAP_TYPE_ARENA] = "arena",
> [BPF_MAP_TYPE_INSN_ARRAY] = "insn_array",
> + [BPF_MAP_TYPE_RHASH] = "rhash",
> };
>
> static const char * const prog_type_name[] = {
> diff --git a/tools/lib/bpf/libbpf_probes.c b/tools/lib/bpf/libbpf_probes.c
> index b70d9637ecf5..e40819465ddc 100644
> --- a/tools/lib/bpf/libbpf_probes.c
> +++ b/tools/lib/bpf/libbpf_probes.c
> @@ -309,6 +309,9 @@ static int probe_map_create(enum bpf_map_type map_type)
> value_size = sizeof(__u64);
> opts.map_flags = BPF_F_NO_PREALLOC;
> break;
> + case BPF_MAP_TYPE_RHASH:
> + opts.map_flags = BPF_F_NO_PREALLOC;
> + break;
> case BPF_MAP_TYPE_CGROUP_STORAGE:
> case BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE:
> key_size = sizeof(struct bpf_cgroup_storage_key);