From patchwork Mon Aug 14 22:00:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 110066 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4896612qge; Mon, 14 Aug 2017 15:00:31 -0700 (PDT) X-Received: by 10.55.148.134 with SMTP id w128mr31640624qkd.36.1502748031700; Mon, 14 Aug 2017 15:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502748031; cv=none; d=google.com; s=arc-20160816; b=FhKOgQ6hDwBs4pKozeqnGj1IO4r9UsZBhT4SWfqKWGn+IEnohD4Gge51osfSNpgfvN C0E6a3RIGIe18QVOZZ4weTA63N/Z7O/t34eIZT7aqglY06dEXFZk7vF81ccGP0WHLGDz tgjpvvygY92Q48z+t2KBafls2H809terCyQJynMtsHx4VxdTZRK2SzH44xv5gjrvgY3/ q+Tyh1aZ4Krij40gPpJFlUtGEkL1RxtYwwElvyhWH7zbueyKj42WzhjHWpvQeb2DipVv Tx9U2qpod1nY/MogmOYqzm4GNTuyfQfbDg+afMuJgwjm8GdYInNzA6J5VboBBy8TZWns 5Jag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=46nO+XLNlv5K4CoVylNGGHGqnZaoZk5eWqt9GtF28bg=; b=OdHldptVJEPseLJEJFsdMQ6HA9117akNCSwqzkhK/568Npp0co9hqbND9Kabqs/50Z 7ax3jzQS9/dgjS77DS9E3o1XWOrxlRkD2PDpjkhg4hKmJOI7j4geXyJaYbnsfzQA/Zc+ Z9uoc/uR8j0OUTP+2nrdBsOJMmfejQv0TtyEUV0Kbc/ZPfZbkSaSjZ/zg9JG//j2EH1O 6RzQb6ZmCcTSG4Y+E6PN+DH7Ee5sUiArTcaZua/NRyU7hw7hhV7lzcqXpXaCREv/rBhs jOmWJee5M8IJN9L69uJNTm3NDfELljNcOozMjk38w7erJvJn/n00p1YJpOQgjHqoEgxn tdtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id q22si7208753qki.270.2017.08.14.15.00.31; Mon, 14 Aug 2017 15:00:31 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id EA3EB65BE3; Mon, 14 Aug 2017 22:00:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 34006644D8; Mon, 14 Aug 2017 22:00:27 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 55476644DC; Mon, 14 Aug 2017 22:00:24 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 1C081644B6 for ; Mon, 14 Aug 2017 22:00:23 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward103j.mail.yandex.net (Yandex) with ESMTP id A984D34C34B5 for ; Tue, 15 Aug 2017 01:00:21 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id t3L8QY9Z02-0LeC5gTT; Tue, 15 Aug 2017 01:00:21 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Ilh82pUDMK-0LFSdv0o; Tue, 15 Aug 2017 01:00:21 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 15 Aug 2017 01:00:03 +0300 Message-Id: <1502748005-17591-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502748005-17591-1-git-send-email-odpbot@yandex.ru> References: <1502748005-17591-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 125 Subject: [lng-odp] [PATCH v2 1/3] linux-generic: packet: improve packet_init() performance X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bill Fischofer Streamline packet_init() performance by eliminating the redundant initialization of the unshared_len field of the packet hdr. This field is initialized when references are created so this processing is not required here. Signed-off-by: Bill Fischofer --- /** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt) ** https://github.com/Linaro/odp/pull/125 ** Patch: https://github.com/Linaro/odp/pull/125.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c **/ platform/linux-generic/include/odp_packet_internal.h | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index d923ee23..48c2463f 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -269,7 +269,6 @@ static inline void packet_init(odp_packet_hdr_t *pkt_hdr, uint32_t len) pkt_hdr->input = ODP_PKTIO_INVALID; /* By default packet has no references */ - pkt_hdr->unshared_len = len; pkt_hdr->ref_hdr = NULL; } From patchwork Mon Aug 14 22:00:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 110067 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4897839qge; Mon, 14 Aug 2017 15:01:30 -0700 (PDT) X-Received: by 10.200.3.45 with SMTP id q45mr33197114qtg.3.1502748090211; Mon, 14 Aug 2017 15:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502748090; cv=none; d=google.com; s=arc-20160816; b=p+RcsJkthbnHuj8slLxo8zD46yr26t5tk3wVZj2JAVDD9vt3BP5EsCbxqVCbqd7mhQ ozUXPcOPXk48kfo5xJNUiJHaCG7dDE79ysYxVpk4QjjQHOV7NtzLntbeELLoUhM2KyXL hQp8eumEg5FIOxa6GFeCw499PIk0paGusfWtW8JoHVJ1Auo4X8WMKNVOiiwgyvmpc3yq uHdmIreFxTtA5lEShhYdHSDA+qiwjsMbFCaglYKtcS/sfpZtP5nj3iniRlWbDbbxJEz5 O/G2feiVNJxQ3BEUeZn1NqpGK1dn6/IN5/rye3vKyYk7e9sAR4SW9PBAnf6eFFLatATU 5DPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=uNaNQ4ZiwqaJLrk40NKUfaEo4uHrccHDpt4waDT3wnM=; b=cUpypwdhQutL2brzlmCAxxMQSwFouxtXHWH1RQlDJLSDRw+60lgOEMxxTkxqZ3cQHn aMm1VgtC9WgkgAdN0LdJFZADH4kurdiuaVJj6Y3LpCyCmYiLZoYAW7LSgtBFiUdjzJlS 8T1zA5ssV4t+4R0X7GmR4AVzCt7vKX3cUW+ZCxApTRCnC1OWBHNo6BUUpd9XkFlTRp1+ gWmKbnbLYBmgkWfVrkqKiFzlEDUNfjxZOfKHUw7t9qzBH/zSeAYoS3ywMZFrnba2kB11 9f3Hgm2HvtOLfotOcf79dez+RUHL9kXo5HvZRyqqjD7eABQ3St3rNilqauq0wuuTORrb 2A6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s6si7310466qkc.26.2017.08.14.15.01.29; Mon, 14 Aug 2017 15:01:30 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id C7E906286D; Mon, 14 Aug 2017 22:01:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 18B2765BE9; Mon, 14 Aug 2017 22:00:34 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id B266F644DA; Mon, 14 Aug 2017 22:00:25 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id EAACE644D8 for ; Mon, 14 Aug 2017 22:00:23 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 48C23183436 for ; Tue, 15 Aug 2017 01:00:22 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id jl6dwcSK50-0MRmX6V1; Tue, 15 Aug 2017 01:00:22 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Ilh82pUDMK-0LF4Xdwr; Tue, 15 Aug 2017 01:00:21 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 15 Aug 2017 01:00:04 +0300 Message-Id: <1502748005-17591-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502748005-17591-1-git-send-email-odpbot@yandex.ru> References: <1502748005-17591-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 125 Subject: [lng-odp] [PATCH v2 2/3] linux-generic: packet: add branch hints for reference optimization X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bill Fischofer Add odp_likely() and odp_unlikely() hints on critical paths in packet allocation / free processing to optimize reference support. Signed-off-by: Bill Fischofer --- /** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt) ** https://github.com/Linaro/odp/pull/125 ** Patch: https://github.com/Linaro/odp/pull/125.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c **/ platform/linux-generic/odp_packet.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index f18bd4dd..a71a5926 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -444,13 +444,14 @@ static inline void free_bufs(odp_packet_hdr_t *pkt_hdr, int first, int num) for (i = 0, nfree = 0; i < num; i++) { odp_packet_hdr_t *hdr = pkt_hdr->buf_hdr.seg[first + i].hdr; - if (packet_ref_count(hdr) == 1 || packet_ref_dec(hdr) == 1) { + if (odp_likely(packet_ref_count(hdr) == 1 || + packet_ref_dec(hdr) == 1)) { ODP_ASSERT((packet_ref_count_set(hdr, 0), 1)); buf_hdr[nfree++] = &hdr->buf_hdr; } } - if (nfree > 0) + if (odp_likely(nfree > 0)) buffer_free_multi(buf_hdr, nfree); } @@ -468,8 +469,8 @@ static inline odp_packet_hdr_t *free_segments(odp_packet_hdr_t *pkt_hdr, for (i = 0, nfree = 0; i < num; i++) { new_hdr = pkt_hdr->buf_hdr.seg[i].hdr; - if (packet_ref_count(new_hdr) == 1 || - packet_ref_dec(new_hdr) == 1) { + if (odp_likely(packet_ref_count(new_hdr) == 1 || + packet_ref_dec(new_hdr) == 1)) { ODP_ASSERT((packet_ref_count_set(new_hdr, 0), 1)); buf_hdr[nfree++] = &new_hdr->buf_hdr; @@ -492,7 +493,7 @@ static inline odp_packet_hdr_t *free_segments(odp_packet_hdr_t *pkt_hdr, pkt_hdr = new_hdr; - if (nfree > 0) + if (odp_likely(nfree > 0)) buffer_free_multi(buf_hdr, nfree); } else { /* Free last 'num' bufs */ @@ -658,7 +659,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int num) ref_hdr = pkt_hdr->ref_hdr; /* Make sure we have enough space for this pkt's segs */ - if (nfree + num_seg > nbufs) { + if (odp_unlikely(nfree + num_seg > nbufs)) { buffer_free_multi(buf_hdr, nfree); nfree = 0; } @@ -681,7 +682,7 @@ void odp_packet_free_multi(const odp_packet_t pkt[], int num) } while (pkt_hdr); } - if (nfree > 0) + if (odp_likely(nfree > 0)) buffer_free_multi(buf_hdr, nfree); } From patchwork Mon Aug 14 22:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 110068 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4898531qge; Mon, 14 Aug 2017 15:02:04 -0700 (PDT) X-Received: by 10.55.107.130 with SMTP id g124mr33018510qkc.210.1502748123867; Mon, 14 Aug 2017 15:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502748123; cv=none; d=google.com; s=arc-20160816; b=VqG18ZwSN2GrG2WwbQkhAzi2A7maMtMyPIkReqQ2x+De59+MqW+cJ2iF3wseLemMKM 8Yj6G5o5BCWSSe7fp9IAkDwj4u2JEYuR1MPM9rJJ499dnvW4C2TRT5vFFs+HBJlrdANV 5RwwVD32T70kEv192ab2ZhprunWRdFZ2LLbbOKEj/yRRlMrw6h4TmZBuSu5b3Q0zoSPw 5V8dpuotYQqlJewPCIA1DE90FPOtofkYbhhYzzSMo0fm8p1CQqiLg0UWGIJ98A8y/UT2 CX+tgZ5Ecd3gykT6dA6korNjd/5QZi/Rx000uAnaOVVzuSBOwq68kxMrvcRZNbv4FmQi SydQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=mlKnbb7atVCjQ4HaZblGS8fHkgpC2CnQXx/9+kMxtS8=; b=XO7OB4mMM4jQQdkzuiv2UCUsKoBfiUnAp92DJEyNlcNsHb3ATQx5HItIWR9R5Wnlu4 tQZiVfoZkeTxkfgcIZd6kth91oW4FeVVqpQfXCo5LuhS4ZhHJ0AuDXdciw9zYGsGC6pV DPqlJ0KCYDL1V4svElMyaQStx8zw5wqBW8ekB2HjeFIGYCzPgdA1Iy9HR3oy07UONiTx /mNfxE/XYEIQe9X/uPC1lCA1Uy8TjAr2kZoqAGU8a01XQAe3sjQqfyjO+pRgbQs7mXqm pjmkLEPboX8nN0K8dR0de1pam4TfP3Gyep6Gaya1jsM0FnVINU9kz+TfEjlh/jWt09bs 2Kmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z200si7048422qka.259.2017.08.14.15.02.03; Mon, 14 Aug 2017 15:02:03 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 5701462D19; Mon, 14 Aug 2017 22:02:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 76AEB65BE0; Mon, 14 Aug 2017 22:00:37 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 2B57564484; Mon, 14 Aug 2017 22:00:27 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 127BA64484 for ; Mon, 14 Aug 2017 22:00:25 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward100p.mail.yandex.net (Yandex) with ESMTP id B4E205102DAF for ; Tue, 15 Aug 2017 01:00:23 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8Glpzt0052-0NV8ZWQQ; Tue, 15 Aug 2017 01:00:23 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Ilh82pUDMK-0MFGkTJs; Tue, 15 Aug 2017 01:00:22 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 15 Aug 2017 01:00:05 +0300 Message-Id: <1502748005-17591-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502748005-17591-1-git-send-email-odpbot@yandex.ru> References: <1502748005-17591-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 125 Subject: [lng-odp] [PATCH v2 3/3] linux-generic: packet: reorder reference fields for performance X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bill Fischofer The ref_count and ref_hdr fields are the only fields referenced in non-reference packet processing paths, so move them to be closer to the current frame_len field so they are in the same cache line. This results in significant improvement in odp_bench_packet measurements. Signed-off-by: Bill Fischofer --- /** Email created from pull request 125 (Bill-Fischofer-Linaro:pktrefs-opt) ** https://github.com/Linaro/odp/pull/125 ** Patch: https://github.com/Linaro/odp/pull/125.patch ** Base sha: 90d4ce1b3b25ca18446131906007571cc0ed0191 ** Merge commit sha: 6d464aeb30e24833ae787e3997a411103c16c70c **/ platform/linux-generic/include/odp/api/plat/packet_types.h | 4 ++-- platform/linux-generic/include/odp_packet_internal.h | 7 ++++--- platform/linux-generic/odp_packet.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index 1554c3af..b7236412 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -84,14 +84,14 @@ typedef struct _odp_packet_inline_offset_t { /** @internal field offset */ size_t tailroom; /** @internal field offset */ - size_t unshared_len; - /** @internal field offset */ size_t ref_hdr; /** @internal field offset */ size_t ref_offset; /** *internal field offset */ size_t ref_len; /** @internal field offset */ + size_t unshared_len; + /** @internal field offset */ size_t pool; /** @internal field offset */ size_t input; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 48c2463f..dfe131b1 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -124,7 +124,8 @@ typedef struct odp_packet_hdr_t { uint32_t tailroom; /* Fields used to support packet references */ - uint32_t unshared_len; + /* Incremented on refs, decremented on frees. */ + odp_atomic_u32_t ref_count; /* Next pkt_hdr in reference chain */ struct odp_packet_hdr_t *ref_hdr; /* Offset into next pkt_hdr that ref was created at */ @@ -133,8 +134,8 @@ typedef struct odp_packet_hdr_t { * allows original offset to be maintained when base pkt len * is changed */ uint32_t ref_len; - /* Incremented on refs, decremented on frees. */ - odp_atomic_u32_t ref_count; + /* Track unshared portion of frame_len */ + uint32_t unshared_len; /* * Members below are not initialized by packet_init() diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index a71a5926..dd5be38a 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -33,10 +33,10 @@ const _odp_packet_inline_offset_t _odp_packet_inline ODP_ALIGNED_CACHE = { .frame_len = offsetof(odp_packet_hdr_t, frame_len), .headroom = offsetof(odp_packet_hdr_t, headroom), .tailroom = offsetof(odp_packet_hdr_t, tailroom), - .unshared_len = offsetof(odp_packet_hdr_t, unshared_len), .ref_hdr = offsetof(odp_packet_hdr_t, ref_hdr), .ref_offset = offsetof(odp_packet_hdr_t, ref_offset), .ref_len = offsetof(odp_packet_hdr_t, ref_len), + .unshared_len = offsetof(odp_packet_hdr_t, unshared_len), .pool = offsetof(odp_packet_hdr_t, buf_hdr.pool_hdl), .input = offsetof(odp_packet_hdr_t, input), .segcount = offsetof(odp_packet_hdr_t, buf_hdr.segcount),