Re: [RFC v2 4/5] io_uring/bpf: add handle events callback

From: Alexei Starovoitov
Date: Wed Jun 11 2025 - 22:29:13 EST


On Fri, Jun 6, 2025 at 6:58 AM Pavel Begunkov <asml.silence@xxxxxxxxx> wrote:
>
> +static inline int io_run_bpf(struct io_ring_ctx *ctx, struct iou_loop_state *state)
> +{
> + scoped_guard(mutex, &ctx->uring_lock) {
> + if (!ctx->bpf_ops)
> + return IOU_EVENTS_STOP;
> + return ctx->bpf_ops->handle_events(ctx, state);
> + }
> +}

you're grabbing the mutex before calling bpf prog and doing
it in a loop million times a second?
Looks like massive overhead for program invocation.
I'm surprised it's fast.