DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ring: add cache guard after ring elements table
@ 2026-04-21 10:23 Morten Brørup
  2026-04-21 17:04 ` Morten Brørup
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Morten Brørup @ 2026-04-21 10:23 UTC (permalink / raw)
  To: dev, Konstantin Ananyev, Wathsala Vithanage; +Cc: Morten Brørup

Added cache guard after the table holding the ring elements, to avoid
false sharing conflicts caused by next-line hardware prefetchers when
accessing elements at the end of the ring table.

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
---
 lib/ring/rte_ring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index f10050a1c4..9ccc62cd42 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -73,8 +73,11 @@ rte_ring_get_memsize_elem(unsigned int esize, unsigned int count)
 		return -EINVAL;
 	}
 
+	static_assert(sizeof(struct rte_ring) == RTE_CACHE_LINE_ROUNDUP(sizeof(struct rte_ring)),
+			"Size of struct rte_ring not cache line aligned");
 	sz = sizeof(struct rte_ring) + (ssize_t)count * esize;
 	sz = RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE);
+	sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;
 	return sz;
 }
 
-- 
2.43.0


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

end of thread, other threads:[~2026-05-11 23:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 10:23 [PATCH] ring: add cache guard after ring elements table Morten Brørup
2026-04-21 17:04 ` Morten Brørup
2026-04-30 17:22 ` Konstantin Ananyev
2026-04-30 18:34   ` Morten Brørup
2026-05-04 12:55     ` Konstantin Ananyev
2026-05-04 13:17       ` Morten Brørup
2026-05-05  7:47         ` Konstantin Ananyev
2026-05-05  8:18           ` Morten Brørup
2026-05-05  9:05             ` Konstantin Ananyev
2026-05-05 16:13 ` [PATCH v2] " Morten Brørup
2026-05-06  1:04   ` fengchengwen
2026-05-11 23:29   ` Wathsala Vithanage

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