From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Subject: Re: [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave Date: Fri, 8 Dec 2017 12:56:30 -0200 Message-ID: <20171208145630.GE3328@localhost.localdomain> References: <2ca21c61e82a44daa29226eac54a4950@AcuMS.aculab.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: 'Xin Long' , network dev , "linux-sctp@vger.kernel.org" , Neil Horman , "davem@davemloft.net" To: David Laight Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44540 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753331AbdLHO4e (ORCPT ); Fri, 8 Dec 2017 09:56:34 -0500 Content-Disposition: inline In-Reply-To: <2ca21c61e82a44daa29226eac54a4950@AcuMS.aculab.com> Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Dec 08, 2017 at 02:06:04PM +0000, David Laight wrote: > From: Xin Long > > Sent: 08 December 2017 13:04 > ... > > @@ -264,8 +264,8 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, > > frag |= SCTP_DATA_SACK_IMM; > > } > > > > - chunk = sctp_make_datafrag_empty(asoc, sinfo, len, frag, > > - 0, GFP_KERNEL); > > + chunk = asoc->stream.si->make_datafrag(asoc, sinfo, len, frag, > > + GFP_KERNEL); > > I know that none of the sctp code is very optimised, but that indirect > call is going to be horrid. Yeah.. but there is no way to avoid the double derreference considering we only have the asoc pointer in there and we have to reach the contents of the data chunk operations struct, and the .si part is the same as 'stream' part as it's a constant offset. Due to the for() in there, we could add a variable to store asoc->stream.si outside the for and then we can do only a single deref inside it. Xin, can you please try and see if the generated code is different? Other suggestions? Marcelo