diff options
author | Song Liu <song@kernel.org> | 2022-07-13 13:49:50 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2022-07-22 22:08:27 +0200 |
commit | ea2babac63d40e59926dc5de4550dac94cc3c6d2 (patch) | |
tree | e05b3cd0a679152dba31f3ca293b43626525555d /samples | |
parent | 00963a2e75a872e5fce4d0115ac2786ec86b57a6 (diff) | |
download | linux-stable-ea2babac63d40e59926dc5de4550dac94cc3c6d2.tar.gz linux-stable-ea2babac63d40e59926dc5de4550dac94cc3c6d2.tar.bz2 linux-stable-ea2babac63d40e59926dc5de4550dac94cc3c6d2.zip |
bpf: Simplify bpf_prog_pack_[size|mask]
Simplify the logic that selects bpf_prog_pack_size, and always use
(PMD_SIZE * num_possible_nodes()). This is a good tradeoff, as most of
the performance benefit observed is from less direct map fragmentation [0].
Also, module_alloc(4MB) may not allocate 4MB aligned memory. Therefore,
we cannot use (ptr & bpf_prog_pack_mask) to find the correct address of
bpf_prog_pack. Fix this by checking the header address falls in the range
of pack->ptr and (pack->ptr + bpf_prog_pack_size).
[0] https://lore.kernel.org/bpf/20220707223546.4124919-1-song@kernel.org/
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20220713204950.3015201-1-song@kernel.org
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions