]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Introduce bpf_prog_pack allocator
authorSong Liu <song@kernel.org>
Fri, 4 Feb 2022 18:57:40 +0000 (10:57 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 8 Feb 2022 02:13:01 +0000 (18:13 -0800)
commit0a066f82325a85f7c53995211b0f6c78e9b0984e
treecbc2dd82f7767f68f07b404e2eb354a9002f1280
parent4c93a844b964852a1e1f054de984604d3ea44f06
bpf: Introduce bpf_prog_pack allocator

Most BPF programs are small, but they consume a page each. For systems
with busy traffic and many BPF programs, this could add significant
pressure to instruction TLB. High iTLB pressure usually causes slow down
for the whole system, which includes visible performance degradation for
production workloads.

Introduce bpf_prog_pack allocator to pack multiple BPF programs in a huge
page. The memory is then allocated in 64 byte chunks.

Memory allocated by bpf_prog_pack allocator is RO protected after initial
allocation. To write to it, the user (jit engine) need to use text poke
API.

Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20220204185742.271030-8-song@kernel.org
kernel/bpf/core.c