[PATCH] stack: rightsize cache guard
Morten Brørup
mb at smartsharesystems.com
Mon May 4 09:15:39 CEST 2026
Using 2 cache lines as cache guard after the table holding the stack
elements may be too many or too few. Instead, use the number of cache
lines specified in the build configuration.
Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
---
lib/stack/rte_stack_lf.c | 2 +-
lib/stack/rte_stack_std.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/stack/rte_stack_lf.c b/lib/stack/rte_stack_lf.c
index 0adcc263e4..db951f6d1b 100644
--- a/lib/stack/rte_stack_lf.c
+++ b/lib/stack/rte_stack_lf.c
@@ -25,7 +25,7 @@ rte_stack_lf_get_memsize(unsigned int count)
/* Add padding to avoid false sharing conflicts caused by
* next-line hardware prefetchers.
*/
- sz += 2 * RTE_CACHE_LINE_SIZE;
+ sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;
return sz;
}
diff --git a/lib/stack/rte_stack_std.c b/lib/stack/rte_stack_std.c
index 0a310d7c63..d5d6e767f1 100644
--- a/lib/stack/rte_stack_std.c
+++ b/lib/stack/rte_stack_std.c
@@ -20,7 +20,7 @@ rte_stack_std_get_memsize(unsigned int count)
/* Add padding to avoid false sharing conflicts caused by
* next-line hardware prefetchers.
*/
- sz += 2 * RTE_CACHE_LINE_SIZE;
+ sz += RTE_CACHE_GUARD_LINES * RTE_CACHE_LINE_SIZE;
return sz;
}
--
2.43.0
More information about the dev
mailing list