Re: [PATCH RFC bpf-next v2 09/18] bpf: Implement alloc and free for resizable hashtab

Alexei Starovoitov
2026-04-12T23:15:40Z

On Wed, Apr 8, 2026 at 8:10 AM Mykyta Yatsenko
<mykyta.yatsenko5@gmail.com> wrote:
>
> From: Mykyta Yatsenko <yatsenko@meta.com>
>
> Initialize rhashtable with bpf_mem_alloc element cache. Require
> BPF_F_NO_PREALLOC. Limit max_entries to 2^31. Free elements via
> rhashtable_free_and_destroy() callback to handle internal structs.
>
> Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
> ---
> kernel/bpf/hashtab.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 60 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> index 492c6a9154b6..a62093d8d1ae 100644
> --- a/kernel/bpf/hashtab.c
> +++ b/kernel/bpf/hashtab.c
> @@ -2762,16 +2762,74 @@ static inline void *rhtab_elem_value(struct rhtab_elem *l, u32 key_size)
>
> static struct bpf_map *rhtab_map_alloc(union bpf_attr *attr)
> {
> - return ERR_PTR(-EOPNOTSUPP);
> + struct bpf_rhtab *rhtab;

patches 6,7,8 are ok as step-by-step,
but this one should be squashed with 1-3