OSDN Git Service

bpf: verifier: Allocate idmap scratch in verifier env
authorLorenz Bauer <lmb@cloudflare.com>
Thu, 29 Apr 2021 13:46:56 +0000 (14:46 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 10 May 2021 23:13:01 +0000 (16:13 -0700)
commitc9e73e3d2b1eb1ea7ff068e05007eec3bd8ef1c9
tree4a7faeae5e95b86efce632ff25f08a15b725dea9
parent06ab6a505583f9adbf5e1f05d86e7bdd7b02248e
bpf: verifier: Allocate idmap scratch in verifier env

func_states_equal makes a very short lived allocation for idmap,
probably because it's too large to fit on the stack. However the
function is called quite often, leading to a lot of alloc / free
churn. Replace the temporary allocation with dedicated scratch
space in struct bpf_verifier_env.

Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Edward Cree <ecree.xilinx@gmail.com>
Link: https://lore.kernel.org/bpf/20210429134656.122225-4-lmb@cloudflare.com
include/linux/bpf_verifier.h
kernel/bpf/verifier.c