From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0074.outbound.protection.outlook.com [104.47.1.74]) by dpdk.org (Postfix) with ESMTP id D5E841B367 for ; Tue, 13 Feb 2018 23:45:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=GGcDugq1Rec/Bi1uHReILGBSmG7mYAiRf1ZO8Nzhkr4=; b=dwS2n0G2/M0LJkRXbQFL16FLXhmgcRcLTMKju0lXsu0Zp1ZxdlKlr7gU6qXyG2Xgq77kpLJQoCNuhrIMHgHg9bC46axyhhiPL3JI7gN+D1Ps0rrKrU1HVDhLtpD7TgcEl6RjQWqHgptRDkOeZsPcLN0rmIr/iv0R+g3zBoXE88g= Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com (10.167.195.147) by VI1PR0501MB2863.eurprd05.prod.outlook.com (10.172.12.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Tue, 13 Feb 2018 22:45:55 +0000 Received: from VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::5ccf:86b:106c:a93a]) by VI1PR0501MB2045.eurprd05.prod.outlook.com ([fe80::5ccf:86b:106c:a93a%14]) with mapi id 15.20.0485.017; Tue, 13 Feb 2018 22:45:55 +0000 From: Yongseok Koh To: Olivier Matz CC: "dev@dpdk.org" Thread-Topic: Accessing 2nd cacheline in rte_pktmbuf_prefree_seg() Thread-Index: AQHTpRxoSpjpp7VOiUGxw51sLWTbeQ== Date: Tue, 13 Feb 2018 22:45:55 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yskoh@mellanox.com; x-originating-ip: [209.116.155.178] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; VI1PR0501MB2863; 7:BJDuecfCSu5pSw1I57nCzxseBaGJPQwBXVGnrzDN2BJZ6P19llcWDWV06R3tY0lF/HU3xfaOcQ2PYKZWq3qf4PcyelYDAvaK+LXX1tlt3ddzNScQF2IckzE9DSMhLj0OJvSfIJkJKJHsrHvqfvKJidYGDS6/5ThPd77QZoCyfUlrLuqaXycC/FmOlfhwHJ9DQOeta4D8qDVGU6qY81De/KjtEwrY37scNrXIj0ZSpG6U/5Pf0QOJsCZ3OtSE24ya x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 7d6a6c96-943f-4ee6-d0ac-08d573338b27 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:VI1PR0501MB2863; x-ms-traffictypediagnostic: VI1PR0501MB2863: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93001095)(3002001)(3231101)(944501161)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0501MB2863; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0501MB2863; x-forefront-prvs: 0582641F53 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(376002)(366004)(39380400002)(346002)(189003)(199004)(501624003)(8936002)(6436002)(81156014)(4326008)(81166006)(25786009)(8676002)(33656002)(6486002)(106356001)(6512007)(83716003)(305945005)(105586002)(68736007)(14454004)(53936002)(82746002)(3280700002)(478600001)(3660700001)(97736004)(5660300001)(6916009)(99286004)(316002)(36756003)(6506007)(2900100001)(86362001)(2906002)(5250100002)(102836004)(66066001)(6116002)(186003)(3846002)(26005)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0501MB2863; H:VI1PR0501MB2045.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: w74zvREXMddAZbpue0jzK9jE9DtmGrkhjvCbf62FVvRgEiBwpoBg2eflJPIYaow9VOGC73hRqKGaUuEKxZ0lBg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <911A85F8BE1088469C9366C2D5C92F22@eurprd05.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d6a6c96-943f-4ee6-d0ac-08d573338b27 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2018 22:45:55.7180 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2863 Subject: [dpdk-dev] Accessing 2nd cacheline in rte_pktmbuf_prefree_seg() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Feb 2018 22:45:57 -0000 Hi Olivier I'm wondering why rte_pktmbuf_prefree_seg() checks m->next instead of m->nb_segs? As 'next' is in the 2nd cacheline, checking nb_segs seems benef= icial to the cases where almost mbufs have single segment. A customer reported high rate of cache misses in the code and I thought the following patch could be helpful. I haven't had them try it yet but just wa= nted to hear from you. I'd appreciate if you can review this idea. diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 62740254d..96edbcb9e 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1398,7 +1398,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) if (RTE_MBUF_INDIRECT(m)) rte_pktmbuf_detach(m); =20 - if (m->next !=3D NULL) { + if (m->nb_segs > 1) { m->next =3D NULL; m->nb_segs =3D 1; } @@ -1410,7 +1410,7 @@ rte_pktmbuf_prefree_seg(struct rte_mbuf *m) if (RTE_MBUF_INDIRECT(m)) rte_pktmbuf_detach(m); =20 - if (m->next !=3D NULL) { + if (m->nb_segs > 1) { m->next =3D NULL; m->nb_segs =3D 1; } Thanks, Yongseok