From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 570B61B299 for ; Wed, 14 Feb 2018 12:48:09 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2018 03:48:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,512,1511856000"; d="scan'208";a="204115356" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga006.fm.intel.com with ESMTP; 14 Feb 2018 03:48:07 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.221]) by IRSMSX153.ger.corp.intel.com ([169.254.9.213]) with mapi id 14.03.0319.002; Wed, 14 Feb 2018 11:48:06 +0000 From: "Ananyev, Konstantin" To: Yongseok Koh , Olivier Matz CC: "dev@dpdk.org" Thread-Topic: Accessing 2nd cacheline in rte_pktmbuf_prefree_seg() Thread-Index: AQHTpRxoSpjpp7VOiUGxw51sLWTbeaOjOjMAgACJaVA= Date: Wed, 14 Feb 2018 11:48:05 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725890572EA2@irsmsx105.ger.corp.intel.com> References: <97910E4F-11F5-4BDB-A460-2656B88EA87D@mellanox.com> In-Reply-To: <97910E4F-11F5-4BDB-A460-2656B88EA87D@mellanox.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDg2NGU3Y2YtNjY0OC00ZDgzLTlhYjMtZmRmYmNmODczMjY4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6ImFyOTRpQzVwalppMlNcL0dWS3BLRjlENHQwdU1ad0s3cHk4Z2ZNWFh6NzBrPSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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: Wed, 14 Feb 2018 11:48:09 -0000 Hi Yongseok, > > On Feb 13, 2018, at 2:45 PM, Yongseok Koh wrote: > > > > 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 b= eneficial > > 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 jus= t wanted > > 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); > > > > - 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); > > > > - if (m->next !=3D NULL) { > > + if (m->nb_segs > 1) { > > m->next =3D NULL; > > m->nb_segs =3D 1; > > } >=20 > Well, m->pool in the 2nd cacheline has to be accessed anyway in order to = put it back to the mempool. > It looks like the cache miss is unavoidable. As a thought: in theory PMD can store pool pointer together with each mbuf = it has to free, then it could be something like: if (rte_pktmbuf_prefree_seg(m[x] !=3D NULL) rte_mempool_put(pool[x], m[x]); Then what you suggested above might help. Konstantin