From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Igor Malovitsa" <igor.malovitsa@gmail.com>, <bpf@vger.kernel.org>
Cc: <daniel@iogearbox.net>, <andrii@kernel.org>,
<martin.lau@linux.dev>, <eddyz87@gmail.com>, <song@kernel.org>,
<yonghong.song@linux.dev>, <jolsa@kernel.org>, <memxor@gmail.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf 1/2] bpf: Load ringbuf consumer_pos under the spinlock
Date: Fri, 16 Oct 2026 16:14:44 +0000 [thread overview]
Message-ID: <DM6EA4NZEW6T.1QXD6YWB6J9JZ@gmail.com> (raw)
In-Reply-To: <20261016003318.529860-2-igor.malovitsa@gmail.com>
On Fri, Oct 16, 2026 at 12:33 AM Igor Malovitsa <igor.malovitsa@gmail.com> wrote:
> - cons_pos = smp_load_acquire(&rb->consumer_pos);
> -
> if (raw_res_spin_lock_irqsave(&rb->spinlock, flags))
> return NULL;
>
> + /* Under the lock, so at most one ring behind producer_pos. */
> + cons_pos = smp_load_acquire(&rb->consumer_pos);
> +
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.
pw-bot: cr
next prev parent reply other threads:[~2026-10-16 16:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 0:33 [PATCH bpf 0/2] bpf: Fix ring buffer checks on 32-bit position wrap Igor Malovitsa
2026-10-16 0:33 ` [PATCH bpf 1/2] bpf: Load ringbuf consumer_pos under the spinlock Igor Malovitsa
2026-10-16 0:47 ` sashiko-bot
2026-10-16 16:14 ` Alexei Starovoitov [this message]
2026-10-16 19:12 ` Igor Malovitsa
2026-10-16 0:33 ` [PATCH bpf 2/2] bpf: Fix user ringbuf empty check on 32-bit position wrap Igor Malovitsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6EA4NZEW6T.1QXD6YWB6J9JZ@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=igor.malovitsa@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.