]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Don't allocate 16M for log buffer by default
authorStanislav Fomichev <sdf@google.com>
Wed, 25 Mar 2020 19:55:21 +0000 (12:55 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 25 Mar 2020 23:13:37 +0000 (00:13 +0100)
commit5adbb0d3669259d39c3252c65cfedcdb2471c8f1
tree05f619c306348627204d7c73646b77b64463a174
parent4789577373eb47e913d9989b4b82f4dddbef8847
libbpf: Don't allocate 16M for log buffer by default

For each prog/btf load we allocate and free 16 megs of verifier buffer.
On production systems it doesn't really make sense because the
programs/btf have gone through extensive testing and (mostly) guaranteed
to successfully load.

Let's assume successful case by default and skip buffer allocation
on the first try. If there is an error, start with BPF_LOG_BUF_SIZE
and double it on each ENOSPC iteration.

v3:
* Return -ENOMEM when can't allocate log buffer (Andrii Nakryiko)

v2:
* Don't allocate the buffer at all on the first try (Andrii Nakryiko)

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200325195521.112210-1-sdf@google.com
tools/lib/bpf/btf.c
tools/lib/bpf/libbpf.c