Re: [PATCH bpf-next v5 2/2] bpf: htab: Reduce elem_size by 8 bytes for small key sizes

From: Alexei Starovoitov

Date: Sun Sep 20 2026 - 20:57:52 EST


On Sun, Sep 20, 2026 at 05:22 PM T.J. Mercier <tjmercier@xxxxxxxxxx> wrote:
> + l = __lookup_elem_raw(htab, head, hash, key, key_size, &n);
> + if (l) {
> + /*
> + * Pairs with smp_wmb() in alloc_htab_elem() to ensure
> + * value/pptr reads happen after key/hash match on
> + * recycled elements.
> + */
> + smp_rmb();
> + return l;
> + }

Is this AI suggestion to add barriers?
I think it should be on the program side.
If users really care then they will add such barriers.
Doing it unconditionally will cost performance for everyone.
Especially on arm64.

If you disagree, please provide ./bench bpf-hashmap-lookup numbers on arm64
to demonstrate that perf is the same.

pw-bot: cr