public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring/zcrx: put refill data into separate cache line
@ 2025-04-05 10:17 Pavel Begunkov
  2025-04-09 13:45 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-04-05 10:17 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence

Refill queue lock and other bits are only used from the allocation path
on the rx softirq side, but it shares the cache line with other fields
like ctx that are used also in the "syscall" path, which causes cache
bouncing when softirq runs on a different CPU.

Separate them into different cache lines. The first one now contains
constant fields used by both contextx, followed by a line responsible
for refill queue data.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/zcrx.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_uring/zcrx.h b/io_uring/zcrx.h
index 706cc7300780..b59c560d5d84 100644
--- a/io_uring/zcrx.h
+++ b/io_uring/zcrx.h
@@ -26,11 +26,11 @@ struct io_zcrx_ifq {
 	struct io_ring_ctx		*ctx;
 	struct io_zcrx_area		*area;
 
+	spinlock_t			rq_lock ____cacheline_aligned_in_smp;
 	struct io_uring			*rq_ring;
 	struct io_uring_zcrx_rqe	*rqes;
-	u32				rq_entries;
 	u32				cached_rq_head;
-	spinlock_t			rq_lock;
+	u32				rq_entries;
 
 	u32				if_rxq;
 	struct device			*dev;
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] io_uring/zcrx: put refill data into separate cache line
  2025-04-05 10:17 [PATCH 1/1] io_uring/zcrx: put refill data into separate cache line Pavel Begunkov
@ 2025-04-09 13:45 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-04-09 13:45 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov


On Sat, 05 Apr 2025 11:17:49 +0100, Pavel Begunkov wrote:
> Refill queue lock and other bits are only used from the allocation path
> on the rx softirq side, but it shares the cache line with other fields
> like ctx that are used also in the "syscall" path, which causes cache
> bouncing when softirq runs on a different CPU.
> 
> Separate them into different cache lines. The first one now contains
> constant fields used by both contextx, followed by a line responsible
> for refill queue data.
> 
> [...]

Applied, thanks!

[1/1] io_uring/zcrx: put refill data into separate cache line
      (no commit info)

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-04-09 13:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-05 10:17 [PATCH 1/1] io_uring/zcrx: put refill data into separate cache line Pavel Begunkov
2025-04-09 13:45 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox