On Fri, Mar 8, 2024 at 4:47 PM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote: > > prog->aux->sleepable is checked very frequently as part of (some) BPF > program run hot paths. So this extra aux indirection seems wasteful and > on busy systems might cause unnecessary memory cache misses. > > Let's move sleepable flag into prog itself to eliminate unnecessary > pointer dereference. > > Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> > --- > include/linux/bpf.h | 8 ++++---- > kernel/bpf/bpf_iter.c | 4 ++-- > kernel/bpf/core.c | 2 +- > kernel/bpf/syscall.c | 6 +++--- > kernel/bpf/trampoline.c | 4 ++-- > kernel/bpf/verifier.c | 12 ++++++------ > kernel/events/core.c | 2 +- > kernel/trace/bpf_trace.c | 2 +- > net/bpf/bpf_dummy_struct_ops.c | 2 +- > 9 files changed, 21 insertions(+), 21 deletions(-) Looks good. It might help Benjamin too to add sleepable callbacks. Separately, noticed that jit_subprogs() doesn't copy sleepable flag into subprogs's aux. This patch doesn't change that. Though subprogs are never called directly probably worth a follow up to copy the flag into subprogs? Just for completeness.