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

[email protected]
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.bpf
Message-ID <0694ce653e21157306a453397ed8233b81a958a1880abffbb0ad4cb5b7504e1d@mail.kernel.org>
> 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.


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31651309438
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.