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

From: Michael S. Tsirkin

Date: Tue Dec 01 2026 - 19:30:00 EST


On Wed, Dec 02, 2026 at 12:09:54AM +0000, Alexei Starovoitov wrote:
> 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.

Oh yes. Yet I don't have control over it.

> 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);


This assumes that every bpf program is tuned for every hardware box it
runs on. It's not gonnu happen.


>
> pw-bot: cr