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:23:30 +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-f177.google.com ([209.85.216.177]:37943 "EHLO mail-qt0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750941AbdLHRXc (ORCPT ); Fri, 8 Dec 2017 12:23:32 -0500 In-Reply-To: <27aff622f1574b329e18ba21922f6e7e@AcuMS.aculab.com> Sender: netdev-owner@vger.kernel.org List-ID: On Sat, Dec 9, 2017 at 12:22 AM, David Laight wrote: > From: Xin Long >> Sent: 08 December 2017 16:18 >> > ... >> >> Alternatively you could preform the dereference in two steps (i.e. declare an si >> >> pointer on the stack and set it equal to asoc->stream.si, then deref >> >> si->make_datafrag at call time. That will at least give the compiler an >> >> opportunity to preload the first pointer. > > You want to save the function pointer itself. > > ... >> Another small difference: >> as you can see, comparing to (X), (Y) is using 0x28(%rsp) in the loop, >> instead of %r13. >> >> So that's what I can see from the related generated code. >> If 0x848(%r13) is not worse than 0x28(%rsp) for cpu, I think >> asoc->stream.si->make_datafrag() is even better. No ? > > That code must have far too many life local variables. > Otherwise there's be a caller saved register available. > 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. For the codes style, comparing to the if-else, I think this one is more readable. (ignore extendible stuff first, as probably no more new type of data chunk).