linux/arch
Mike Rapoport (Microsoft) c7a2a36182 x86/bpf: Make arch_bpf_trampoline_size allocate from EXECMEM_MODULE_DATA
Jiri Olsa reports slowdown of tracing_multi benchmark that allocates huge
number of trampolines [1].

The slowdown caused by extra protection changes in execmem_alloc_rw() and
execmem_free().

With ROX caches enabled, all execmem allocations except EXECMEM_MODULE_DATA
are ROX after the allocation. execmem_alloc_rw() temporarily sets them to
W+NX and execmem_free() resets them back to ROX.

The only user of bpf_jit_alloc_exec_rw() is x86::arch_bpf_trampoline_size()
that only needs a temporary writable buffer in the modules address space.

On x86 executable memory and module data are constrained to the same
address range, so x86::arch_bpf_trampoline_size() can directly use
execmem_alloc(EXECMEM_MODULE_DATA)

Replace the call to bpf_jit_alloc_exec_rw() with a call to
execmem_alloc(EXECMEM_MODULE_DATA) in x86::arch_bpf_trampoline_size() and
drop bpf_jit_alloc_exec_rw() helper.

Fixes: 5bf02dbf39 ("bpf, x86: Make sure allocation in arch_bpf_trampoline_size() is writable")
Reported-by: Jiri Olsa <olsajiri@gmail.com>
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/all/an8r7EODLIL-bZM3@krava
Link: https://lore.kernel.org/bpf/20260818130510.3110054-1-rppt@kernel.org
2026-08-20 17:52:31 +02:00
..
alpha Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
arc Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
arm This update includes the following changes: 2026-08-19 17:25:42 -07:00
arm64 Major changes: 2026-08-20 07:36:20 -07:00
csky csky 7.3 Release Notes 2026-08-18 19:32:34 -07:00
hexagon Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
loongarch VDSO updates: 2026-08-18 16:56:25 -07:00
m68k Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
microblaze Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
mips Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
nios2 ptrace, treewide: Rename ptrace_report_syscall_entry() to ptrace_report_syscall_permit_entry() 2026-07-12 12:38:02 +02:00
openrisc Treewide timer related cleanups: 2026-08-18 15:58:29 -07:00
parisc Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
powerpc Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
riscv Major changes: 2026-08-20 07:36:20 -07:00
s390 Major changes: 2026-08-20 07:36:20 -07:00
sh gpio updates for v7.3-rc1 2026-08-19 09:10:07 -07:00
sparc Networking changes for 7.3. 2026-08-20 08:16:04 -07:00
um - Get rid of static_cpu_has() - one less API to care about testing CPU 2026-08-18 19:09:42 -07:00
x86 x86/bpf: Make arch_bpf_trampoline_size allocate from EXECMEM_MODULE_DATA 2026-08-20 17:52:31 +02:00
xtensa Generic entry code updates: 2026-08-18 15:00:56 -07:00
.gitignore
Kconfig VDSO updates: 2026-08-18 16:56:25 -07:00