btf: allow to customize dedup hash table size
authorAndrii Nakryiko <andriin@fb.com>
Thu, 28 Feb 2019 23:31:23 +0000 (15:31 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 1 Mar 2019 00:31:47 +0000 (01:31 +0100)
commit51edf5f6e015c48b62e24ab2fbcad8885ca1c74e
treef62542a11348c36a6e3ef331659a7d17f0e6806c
parent1baabdc1089eb807cdcabebad50b36c8b9895a48
btf: allow to customize dedup hash table size

Default size of dedup table (16k) is good enough for most binaries, even
typical vmlinux images. But there are cases of binaries with huge amount
of BTF types (e.g., allyesconfig variants of kernel), which benefit from
having bigger dedup table size to lower amount of unnecessary hash
collisions. Tools like pahole, thus, can tune this parameter to reach
optimal performance.

This change also serves double purpose of allowing tests to force hash
collisions to test some corner cases, used in follow up patch.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/btf.c
tools/lib/bpf/btf.h