Re: [PATCH bpf 1/2] bpf: Load ringbuf consumer_pos under the spinlock

From: Igor Malovitsa

Date: Fri Oct 16 2026 - 15:16:22 EST


On Fri, Oct 16, 2026 at 16:14:44 +0000, Alexei Starovoitov wrote:

> libbpf writes consumer_pos after every record, so this load is
> a cache miss most of the time.
> Today it's done before the lock. With this patch all other producers
> spin on the lock while this cpu waits for it. On 64-bit too.
> So "Neither changes anything on 64-bit" in the cover letter is not correct.
>
> imo it's not worth slowing down everyone for that.

Thank you for the quick review. I do agree that a bug limited to 32-bit,
requiring 4GB of traffic to reproduce is not worth the trouble.
The reason I raised this patch is building a formal model and
discovering there's technically a bug. If this corner case is
not a concern, I can abandon this patch.
The second patch is zero cost, though.