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

"T.J. Mercier" <[email protected]>
Newsgroups org.kernel.vger.bpf,org.kernel.vger.linux-kernel
Message-ID <CABdmKX24rd0F_U9TkPrrbj=4buj7UbrMseTf_RaEk0bXS=VVyw@mail.gmail.com>
On Wed, Aug 12, 2026 at 5:22 PM <[email protected]> wrote:
>
> > diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c
> > index fed4b1db8b78b..720766121ea2b 100644
> > --- a/kernel/bpf/hashtab.c
> > +++ b/kernel/bpf/hashtab.c
>
> [ ... ]
>
> > diff --git a/tools/testing/selftests/bpf/progs/map_ptr_kern.c b/tools/testing/selftests/bpf/progs/map_ptr_kern.c
> > index 373c8d17ea557..6bd4cb68c20c1 100644
> > --- a/tools/testing/selftests/bpf/progs/map_ptr_kern.c
> > +++ b/tools/testing/selftests/bpf/progs/map_ptr_kern.c
> > @@ -114,7 +114,7 @@ static inline int check_hash(void)
> >       VERIFY(check_default_noinline(&hash->map, map));
> >
> >       VERIFY(hash->n_buckets == MAX_ENTRIES);
> > -     VERIFY(hash->elem_size == 64);
> > +     VERIFY(hash->elem_size == 32);
> >
> >       VERIFY(hash->count.counter == 0);
> >       VERIFY(bpf_map_sum_elem_count(map) == 0);
>
> Should this expectation change have been split across two commits for
> bisectability? The preceding commit 1066507e33e67 dropped the
> freelist/lru union from struct htab_elem, which moves elem_size to 40,
> but that commit leaves the selftest checking for 64. This means the
> map_ptr selftest fails at 1066507e33e67 and only passes again here
> where elem_size becomes 32.

Yes, it should be 40 in the last patch, and 32 here.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.