From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 0EE388DB5 for ; Wed, 23 Sep 2015 15:07:23 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 23 Sep 2015 06:07:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,577,1437462000"; d="scan'208";a="566929082" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by FMSMGA003.fm.intel.com with ESMTP; 23 Sep 2015 06:07:04 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.216]) by IRSMSX103.ger.corp.intel.com ([169.254.3.168]) with mapi id 14.03.0248.002; Wed, 23 Sep 2015 14:07:02 +0100 From: "Dumitrescu, Cristian" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v1 1/3] port: add mp/mc ring ports Thread-Index: AQHQ9L3RcBRdJ8kTrEqxaT0KiM6tFZ5Ia07AgAAfDYCAAYhS0A== Date: Wed, 23 Sep 2015 13:07:01 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D89126478D6D32@IRSMSX108.ger.corp.intel.com> References: <1442322395-23365-1-git-send-email-piotrx.t.azarewicz@intel.com> <20150921153530.0b198652@urahara> <3EB4FA525960D640B5BDFFD6A3D89126478D65D5@IRSMSX108.ger.corp.intel.com> <3616846.ZsjBrqIcvx@xps13> In-Reply-To: <3616846.ZsjBrqIcvx@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v1 1/3] port: add mp/mc ring ports X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Sep 2015 13:07:24 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Tuesday, September 22, 2015 5:24 PM > To: Dumitrescu, Cristian > Cc: dev@dpdk.org; Stephen Hemminger; Azarewicz, PiotrX T > Subject: Re: [dpdk-dev] [PATCH v1 1/3] port: add mp/mc ring ports >=20 > 2015-09-22 11:34, Dumitrescu, Cristian: > > > > > -----Original Message----- > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen > > > Hemminger > > > Sent: Tuesday, September 22, 2015 1:36 AM > > > To: Azarewicz, PiotrX T > > > Cc: dev@dpdk.org > > > Subject: Re: [dpdk-dev] [PATCH v1 1/3] port: add mp/mc ring ports > > > > > > On Tue, 15 Sep 2015 15:06:33 +0200 > > > Piotr Azarewicz wrote: > > > > > > > +static inline void > > > > +send_burst_mp(struct rte_port_ring_writer *p) > > > > +{ > > > > > > compiler will inline static functions anyway. No need to add inline q= ualifier > > > > Hi Stephen, > > > > Using 'static inline' seems to be the standard practice in DPDK and a g= ood > practice as well. >=20 > Why do you think it is a good practice? > Forced inlining can be a random optimization having negative effects. >=20 What I meant is this: when users want to make sure their code gets inlined = by the compiler, it is better to explicitly state this by using the mechani= sms provided by the C compiler (C keyword "inline" and compiler pragmas lik= e "always inline") rather than hope that compiler is going to do this anywa= y. I have been burned in the past by compilers not inlining code even when = explicitly stated, so I am a quite sceptical about compilers doing it proac= tively. Your point is slightly different: why use code inlining at all? IMHO this d= iscussion is outside the scope of this patch and should be conducted as a s= eparate debate. Please feel free to start it as a separate thread if you de= em necessary. As said, there are already 1700 instances of "static inline" = in DPDK, as well as lots of "always inline". In the context of this debate (outside the scope of this patch), my quick i= nput is: compilers are typically good to optimize code at the function lev= el rather than cross-functions, so having more code in the same function al= lows the compiler to do a better job at code optimization. I am not a compi= ler expert, so my views could simply be biased by my past experience. > > DPDK> grep 'static inline' `find -name '*.[hc]'` | wc -l > > 1700