All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
	'Xin Long' <lucien.xin@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	"linux-sctp@vger.kernel.org" <linux-sctp@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave
Date: Fri, 08 Dec 2017 16:00:01 +0000	[thread overview]
Message-ID: <20171208160001.GF3328@localhost.localdomain> (raw)
In-Reply-To: <20171208153734.GB6955@hmswarspite.think-freely.org>

On Fri, Dec 08, 2017 at 10:37:34AM -0500, Neil Horman wrote:
> On Fri, Dec 08, 2017 at 12:56:30PM -0200, Marcelo Ricardo Leitner wrote:
> > 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?
> > 
> Is it worth replacing the si struct with an index/enum value, and indexing an
> array of method pointer structs?  That would save you at least one dereference.

Hmmm, maybe, yes. It would be like
sctp_stream_interleave[asoc->stream.si].make_datafrag(...)

Then same goes for pf->af, probably.

> 
> 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.

Yep, that was my 2nd paragraph above :-) but it only works for cases
such as this one.

  Marcelo

> 
> Neil
> 
> >   Marcelo
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: David Laight <David.Laight@ACULAB.COM>,
	'Xin Long' <lucien.xin@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	"linux-sctp@vger.kernel.org" <linux-sctp@vger.kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave
Date: Fri, 8 Dec 2017 14:00:01 -0200	[thread overview]
Message-ID: <20171208160001.GF3328@localhost.localdomain> (raw)
In-Reply-To: <20171208153734.GB6955@hmswarspite.think-freely.org>

On Fri, Dec 08, 2017 at 10:37:34AM -0500, Neil Horman wrote:
> On Fri, Dec 08, 2017 at 12:56:30PM -0200, Marcelo Ricardo Leitner wrote:
> > 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?
> > 
> Is it worth replacing the si struct with an index/enum value, and indexing an
> array of method pointer structs?  That would save you at least one dereference.

Hmmm, maybe, yes. It would be like
sctp_stream_interleave[asoc->stream.si].make_datafrag(...)

Then same goes for pf->af, probably.

> 
> 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.

Yep, that was my 2nd paragraph above :-) but it only works for cases
such as this one.

  Marcelo

> 
> Neil
> 
> >   Marcelo
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2017-12-08 16:00 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08 13:03 [PATCHv2 net-next 00/12] sctp: Implement Stream Interleave: The I-DATA Chunk Supporting User Message Xin Long
2017-12-08 13:03 ` [PATCHv2 net-next 00/12] sctp: Implement Stream Interleave: The I-DATA Chunk Supporting User Message Interleaving Xin Long
2017-12-08 13:03 ` [PATCHv2 net-next 01/12] sctp: add stream interleave enable members and sockopt Xin Long
2017-12-08 13:03   ` Xin Long
2017-12-08 13:03   ` [PATCHv2 net-next 02/12] sctp: add asoc intl_enable negotiation during 4 shakehands Xin Long
2017-12-08 13:03     ` Xin Long
2017-12-08 13:04     ` [PATCHv2 net-next 03/12] sctp: add basic structures and make chunk function for idata Xin Long
2017-12-08 13:04       ` Xin Long
2017-12-08 13:04       ` [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave Xin Long
2017-12-08 13:04         ` Xin Long
2017-12-08 13:04         ` [PATCHv2 net-next 05/12] sctp: implement assign_number " Xin Long
2017-12-08 13:04           ` Xin Long
2017-12-08 13:04           ` [PATCHv2 net-next 06/12] sctp: implement validate_data " Xin Long
2017-12-08 13:04             ` Xin Long
2017-12-08 13:04             ` [PATCHv2 net-next 07/12] sctp: implement ulpevent_data " Xin Long
2017-12-08 13:04               ` Xin Long
2017-12-08 13:04               ` [PATCHv2 net-next 08/12] sctp: implement enqueue_event " Xin Long
2017-12-08 13:04                 ` Xin Long
2017-12-08 13:04                 ` [PATCHv2 net-next 09/12] sctp: implement renege_events " Xin Long
2017-12-08 13:04                   ` Xin Long
2017-12-08 13:04                   ` [PATCHv2 net-next 10/12] sctp: implement start_pd " Xin Long
2017-12-08 13:04                     ` Xin Long
2017-12-08 13:04                     ` [PATCHv2 net-next 11/12] sctp: implement abort_pd " Xin Long
2017-12-08 13:04                       ` Xin Long
2017-12-08 13:04                       ` [PATCHv2 net-next 12/12] sctp: add support for the process of unordered idata Xin Long
2017-12-08 13:04                         ` Xin Long
2017-12-08 14:06         ` [PATCHv2 net-next 04/12] sctp: implement make_datafrag for sctp_stream_interleave David Laight
2017-12-08 14:06           ` David Laight
2017-12-08 14:56           ` Marcelo Ricardo Leitner
2017-12-08 14:56             ` Marcelo Ricardo Leitner
2017-12-08 15:01             ` David Laight
2017-12-08 15:01               ` David Laight
2017-12-08 15:15               ` 'Marcelo Ricardo Leitner'
2017-12-08 15:15                 ` 'Marcelo Ricardo Leitner'
2017-12-08 15:32                 ` David Laight
2017-12-08 15:32                   ` David Laight
2017-12-08 16:02                   ` 'Marcelo Ricardo Leitner'
2017-12-08 16:02                     ` 'Marcelo Ricardo Leitner'
2017-12-08 15:37             ` Neil Horman
2017-12-08 15:37               ` Neil Horman
2017-12-08 16:00               ` Marcelo Ricardo Leitner [this message]
2017-12-08 16:00                 ` Marcelo Ricardo Leitner
2017-12-08 16:04                 ` David Laight
2017-12-08 16:04                   ` David Laight
2017-12-08 16:08                   ` Neil Horman
2017-12-08 16:08                     ` Neil Horman
2017-12-08 20:37                     ` 'Marcelo Ricardo Leitner'
2017-12-08 20:37                       ` 'Marcelo Ricardo Leitner'
2017-12-08 16:17                 ` Xin Long
2017-12-08 16:17                   ` Xin Long
2017-12-08 16:22                   ` David Laight
2017-12-08 16:22                     ` David Laight
2017-12-08 17:23                     ` Xin Long
2017-12-08 17:23                       ` Xin Long
2017-12-08 17:29                       ` David Laight
2017-12-08 17:29                         ` David Laight
2017-12-08 17:37                         ` Xin Long
2017-12-08 17:37                           ` Xin Long
2017-12-11 16:23 ` [PATCHv2 net-next 00/12] sctp: Implement Stream Interleave: The I-DATA Chunk Supporting User Mes David Miller
2017-12-11 16:23   ` [PATCHv2 net-next 00/12] sctp: Implement Stream Interleave: The I-DATA Chunk Supporting User Message Interleaving David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171208160001.GF3328@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.