From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: [PATCH 1/2] mbuf: fix performance/cache resource issue with 128-byte cache line targets Date: Sun, 6 Dec 2015 21:29:23 +0530 Message-ID: <1449417564-29600-2-git-send-email-jerin.jacob@caviumnetworks.com> References: <1449417564-29600-1-git-send-email-jerin.jacob@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain To: Return-path: Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2on0077.outbound.protection.outlook.com [207.46.100.77]) by dpdk.org (Postfix) with ESMTP id 26D399252 for ; Sun, 6 Dec 2015 17:00:15 +0100 (CET) In-Reply-To: <1449417564-29600-1-git-send-email-jerin.jacob@caviumnetworks.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- app/test/test_mbuf.c | 4 ++++ lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 4 ++++ lib/librte_mbuf/rte_mbuf.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index b32bef6..5e21075 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -930,7 +930,11 @@ test_failing_mbuf_sanity_check(void) static int test_mbuf(void) { +#if RTE_CACHE_LINE_SIZE == 64 RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_LINE_SIZE * 2); +#elif RTE_CACHE_LINE_SIZE == 128 + RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) != RTE_CACHE_LINE_SIZE); +#endif /* 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..e724af7 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 @@ -121,8 +121,12 @@ struct rte_kni_mbuf { uint32_t pkt_len; /**< Total pkt len: sum of all segment data_len. */ uint16_t data_len; /**< Amount of data in segment buffer. */ +#if RTE_CACHE_LINE_SIZE == 64 /* fields on second cache line */ char pad3[8] __attribute__((__aligned__(RTE_CACHE_LINE_SIZE))); +#elif RTE_CACHE_LINE_SIZE == 128 + char pad3[24]; +#endif void *pool; void *next; }; diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index f234ac9..0bf55e0 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -813,8 +813,10 @@ struct rte_mbuf { uint16_t vlan_tci_outer; /**< Outer VLAN Tag Control Identifier (CPU order) */ +#if RTE_CACHE_LINE_SIZE == 64 /* second cache line - fields only used in slow path or on TX */ MARKER cacheline1 __rte_cache_aligned; +#endif union { void *userdata; /**< Can be used for external metadata */ -- 2.1.0