|SUCCESS| ring: add cache guard after ring elements table
dpdklab at iol.unh.edu
dpdklab at iol.unh.edu
Tue Apr 21 15:00:32 CEST 2026
Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/163220
_AI Code Review_
=== Patch Review: series.patch (via Claude) ===
Review date: 2026-04-21
git commit: [hash from patch metadata]
Author: Morten Brorup <mb at smartsharesystems.com>
Subject: [PATCH] ring: add cache guard after ring elements table
This patch adds a cache guard after the ring elements table to prevent
false sharing from hardware prefetchers when accessing elements at the end
of the ring.
> 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");
Does this static assertion belong in rte_ring_get_memsize_elem()? This
function is called at runtime, but static_assert is evaluated at compile
time. The assertion checks a property of struct rte_ring that should be
validated regardless of whether this specific function is called. Would
placing this at file scope or in a header be more appropriate?
The assertion line exceeds 100 characters. Can this be wrapped to comply
with the coding style guide?
> 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;
Does adding the guard size after RTE_ALIGN() guarantee the guard space is
properly accounted for in all allocation paths? Does every code path that
uses this size value allocate memory that includes this guard region?
Does this guard size addition need to be conditional based on whether
RTE_CACHE_GUARD_LINES is defined or non-zero? If RTE_CACHE_GUARD_LINES is
undefined in some configurations, does this code compile correctly?
> return sz;
> }
More information about the test-report
mailing list