From: "Michael S. Tsirkin" <mst@redhat.com>
To: Simon Schippers <simon.schippers@tu-dortmund.de>
Cc: netdev@vger.kernel.org, "Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
"Tim Gebauer" <tim.gebauer@tu-dortmund.de>,
"Jonas Köppeler" <j.koeppeler@tu-berlin.de>,
"Jason Wang" <jasowangio@gmail.com>,
"Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>,
"Stanislav Fomichev" <sdf@fomichev.me>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 1/3] ptr_ring: add PTR_RING_BATCH
Date: Fri, 27 Nov 2026 13:58:50 -0500 [thread overview]
Message-ID: <20261127135832-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20261125152311.805325-2-simon.schippers@tu-dortmund.de>
On Wed, Nov 25, 2026 at 04:23:09PM +0100, Simon Schippers wrote:
> Name the batch size in which the consumer frees entries, so that users
> of a ring can size their own work to it. The next patch uses it in veth.
>
> No functional change.
>
> Signed-off-by: Simon Schippers <simon.schippers@tu-dortmund.de>
> ---
> include/linux/ptr_ring.h | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/ptr_ring.h b/include/linux/ptr_ring.h
> index 631c43fde4407..b851a9c170bf6 100644
> --- a/include/linux/ptr_ring.h
> +++ b/include/linux/ptr_ring.h
> @@ -27,6 +27,11 @@
> #include <asm/errno.h>
> #endif
>
> +/* Consumed entries are freed in batches of this size, unless the ring is
> + * smaller than two batches
> + */
> +#define PTR_RING_BATCH (SMP_CACHE_BYTES * 2 / (int)sizeof(void *))
> +
> struct ptr_ring {
> int producer ____cacheline_aligned_in_smp;
> spinlock_t producer_lock;
> @@ -506,7 +511,7 @@ static inline void **__ptr_ring_init_queue_alloc_noprof(unsigned int size, gfp_t
> static inline void __ptr_ring_set_size(struct ptr_ring *r, int size)
> {
> r->size = size;
> - r->batch = SMP_CACHE_BYTES * 2 / sizeof(*(r->queue));
> + r->batch = PTR_RING_BATCH;
> /* We need to set batch at least to 1 to make logic
> * in __ptr_ring_discard_one work correctly.
> * Batching too much (because ring is small) would cause a lot of
If this helps, sure:
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> --
> 2.43.0
next prev parent reply other threads:[~2026-11-27 18:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 15:23 [PATCH net-next 0/3] veth: earlier txq wake and stop under backpressure Simon Schippers
2026-11-25 15:23 ` [PATCH net-next 1/3] ptr_ring: add PTR_RING_BATCH Simon Schippers
2026-11-27 18:58 ` Michael S. Tsirkin [this message]
2026-11-25 15:23 ` [PATCH net-next 2/3] veth: wake the peer txq in the middle of the NAPI poll Simon Schippers
2026-11-25 15:23 ` [PATCH net-next 3/3] veth: stop the txq as soon as the ptr_ring is full Simon Schippers
2026-11-26 18:06 ` [PATCH net-next 0/3] veth: earlier txq wake and stop under backpressure Simon Schippers
2026-12-02 4:00 ` patchwork-bot+netdevbpf
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=20261127135832-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hawk@kernel.org \
--cc=j.koeppeler@tu-berlin.de \
--cc=jasowangio@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=simon.schippers@tu-dortmund.de \
--cc=tim.gebauer@tu-dortmund.de \
/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.