From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4937FC3E0 for ; Wed, 21 Oct 2015 17:57:42 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP; 21 Oct 2015 08:57:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,712,1437462000"; d="scan'208";a="585410342" Received: from bricha3-mobl3.ger.corp.intel.com (HELO [10.237.208.65]) ([10.237.208.65]) by FMSMGA003.fm.intel.com with ESMTP; 21 Oct 2015 08:57:28 -0700 To: dev@dpdk.org References: <1445399294-18826-1-git-send-email-yuanhan.liu@linux.intel.com> <2601191342CEEE43887BDE71AB97725836AB321F@irsmsx105.ger.corp.intel.com> <20151021084747.6c2ca303@xeon-e3> <2344789.5MT16lH3ET@xps13> From: Bruce Richardson Message-ID: <5627B5E7.2010105@intel.com> Date: Wed, 21 Oct 2015 16:57:27 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <2344789.5MT16lH3ET@xps13> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v7 4/8] vhost: rxtx: use queue id instead of constant ring index 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, 21 Oct 2015 15:57:42 -0000 On 21/10/2015 16:52, Thomas Monjalon wrote: > 2015-10-21 08:47, Stephen Hemminger: >> On Wed, 21 Oct 2015 09:38:37 +0000 >> "Ananyev, Konstantin" wrote: >>> I also don't understand what's wrong with using 'always_inline' here. >>> As I understand the author wants compiler to *always inline* that function. >>> So seems perfectly ok to use it here. >>> As I remember just 'inline' is sort of recommendation that compiler is free to ignore. >>> Konstantin >> I follow Linux/Linus advice and resist the urge to add strong inlining. >> The compiler does a good job of deciding to inline, and many times >> the reason it chooses for not inlining are quite good like: >> - the code is on an unlikely branch >> - register pressure means inlining would mean the code would be worse >> >> Therefore my rules are: >> * only use inline for small functions. Let compiler decide on larger static funcs >> * write code where most functions are static (localized scope) where compiler >> can decide >> * reserve always inline for things that access hardware and would break if not inlined. > It would be interesting to do some benchmarks with/without "always" keyword > and add these rules in the coding style guide. > Better test would be to measure the hit by explicitly not having it inlined. You need to know the hit of the compiler making the wrong choice, even if it normally makes the right one. Bruce