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 <[email protected]>
---
 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

Reply via email to