Re: [PATCH] bpf: ringbuf: add wakeup coalescing

From: Alexei Starovoitov

Date: Tue Dec 01 2026 - 19:10:06 EST


On Tue, Dec 01, 2026 at 06:39 AM Michael S. Tsirkin <mst@xxxxxxxxxx> wrote:
> Add per-ringbuf pending count and wakeup threshold to coalesce wakeups:
> first record after idle wakes immediately, next ones are batched. This
> reduces context-switch churn substantially under bursty traffic while
> keeping latency low.

Sounds like your tracing tool is simply inefficient.
No need for kernel changes. The prog can do it today.
BPF_RB_NO_WAKEUP, BPF_RB_FORCE_WAKEUP and bpf_ringbuf_query() exist for
that.

avail = bpf_ringbuf_query(&rb, BPF_RB_AVAIL_DATA);
bpf_ringbuf_submit(rec, avail >= wakeup_data_size ?
BPF_RB_FORCE_WAKEUP : BPF_RB_NO_WAKEUP);

pw-bot: cr