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),