From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xin Long Subject: Re: [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave Date: Sat, 9 Dec 2017 01:37:14 +0800 Message-ID: References: <2ca21c61e82a44daa29226eac54a4950@AcuMS.aculab.com> <20171208145630.GE3328@localhost.localdomain> <20171208153734.GB6955@hmswarspite.think-freely.org> <20171208160001.GF3328@localhost.localdomain> <27aff622f1574b329e18ba21922f6e7e@AcuMS.aculab.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Marcelo Ricardo Leitner , Neil Horman , network dev , "linux-sctp@vger.kernel.org" , "davem@davemloft.net" To: David Laight Return-path: Received: from mail-qt0-f172.google.com ([209.85.216.172]:39724 "EHLO mail-qt0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbdLHRhP (ORCPT ); Fri, 8 Dec 2017 12:37:15 -0500 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sat, Dec 9, 2017 at 1:29 AM, David Laight wrote: > From: Xin Long ... >> Hi, David, Sorry, I'm not sure we're worrying about the cpu cost or >> codes style now ? >> >> For cpu cost, I think 0x848(%r13) operation must be better than the >> generated code of if-else. > > Nope - the call xxx(%ryyy) is likely to be a data cache miss and a complete > cpu pipeline stall. > > The conditional will be a data cache hit and the code (for one branch) > will be prefetched and speculatively executed. > > Some very modern cpu might manage to predict indirect jumps, but for > most it is a full pipeline stall. Thanks for the CPU information. The thing is with if-else can't avoid xxx(%ryyy) in this case, as Marcelo said above. It seems if-else will just be a extra cost compare to this one.