Re: [PATCH] bpf: ringbuf: add wakeup coalescing
From: Alexei Starovoitov
Date: Wed Dec 02 2026 - 23:03:18 EST
On Tue, Dec 01, 2026 at 11:19 PM Michael S. Tsirkin <mst@xxxxxxxxxx> wrote:
>> No. Not every ringbuf is a stream of samples.
>
> Right. What if I limit it per type or something? Can make it
> palatable?
No. The type doesn't tell a stream of samples from a one-off signal.
A ringbuf isn't tied to a prog type either.
Progs of different types can share one.
> Shrug. I didn't write this thing. So what can be done about misbehaving
> ones, that hammer the box with wakeups on every event anywhere under /?
> Any idea?
It's a wakeup per event only while the consumer keeps up with the prog.
bpf_ringbuf_commit() with flags == 0:
else if (cons_pos == rec_pos && !(flags & BPF_RB_NO_WAKEUP))
irq_work_queue(&rb->work);
So slow down the consumer. Try cpu.max on the cgroup of the tool.
Once the tool is out of quota:
prog consumer
rec 1: cons_pos == rec_pos
wakeup
throttled before it reads rec 1
rec 2 to N: cons_pos != rec_pos
no wakeup
next period: reads rec 1 to N
That's per box and per tool. No need for kernel changes.
If the quota is too low the ring fills up and records are lost.