DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: dev@dpdk.org
Cc: "Morten Brørup" <mb@smartsharesystems.com>
Subject: [PATCH] stack: rightsize cache guard
Date: Mon,  4 May 2026 07:15:39 +0000	[thread overview]
Message-ID: <20260504071539.252926-1-mb@smartsharesystems.com> (raw)

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@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


             reply	other threads:[~2026-05-04  7:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04  7:15 Morten Brørup [this message]
2026-06-01 15:58 ` [PATCH] stack: rightsize cache guard Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260504071539.252926-1-mb@smartsharesystems.com \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox