[dpdk-dev,v2,2/4] mbuf: fix performance/cache resource issue with 128-byte cache line targets

Message ID 1449765378-29563-3-git-send-email-jerin.jacob@caviumnetworks.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Jerin Jacob Dec. 10, 2015, 4:36 p.m. UTC
No need to split mbuf structure to two cache lines for 128-byte cache line
size targets as it can fit on a single 128-byte cache line.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 app/test/test_mbuf.c                                          | 2 +-
 lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 4 +++-
 lib/librte_mbuf/rte_mbuf.h                                    | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)
  

Patch

diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index b32bef6..c99b82d 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -930,7 +930,7 @@  test_failing_mbuf_sanity_check(void)
 static int
 test_mbuf(void)
 {
-	RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_LINE_SIZE * 2);
+	RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_MIN_LINE_SIZE * 2);
 
 	/* create pktmbuf pool if it does not exist */
 	if (pktmbuf_pool == NULL) {
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index bd1cc09..be51916 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -72,6 +72,8 @@ 
 #define RTE_CACHE_LINE_SIZE 64       /**< Cache line size. */
 #endif
 
+#define RTE_CACHE_MIN_LINE_SIZE 64   /**< Minimum Cache line size. */
+
 /*
  * Request id.
  */
@@ -122,7 +124,7 @@  struct rte_kni_mbuf {
 	uint16_t data_len;      /**< Amount of data in segment buffer. */
 
 	/* fields on second cache line */
-	char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_SIZE)));
+	char pad3[8]  __attribute__((__aligned__(RTE_CACHE_MIN_LINE_SIZE)));
 	void *pool;
 	void *next;
 };
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index f234ac9..c973e9b 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -814,7 +814,7 @@  struct rte_mbuf {
 	uint16_t vlan_tci_outer;  /**< Outer VLAN Tag Control Identifier (CPU order) */
 
 	/* second cache line - fields only used in slow path or on TX */
-	MARKER cacheline1 __rte_cache_aligned;
+	MARKER cacheline1 __rte_cache_min_aligned;
 
 	union {
 		void *userdata;   /**< Can be used for external metadata */