Re: [PATCH] scsi: avoid to fetch scsi host template instance in IO path

Ming Lei
2020-03-02T22:31:03Z

On Mon, Mar 02, 2020 at 02:15:41PM +0100, Christoph Hellwig wrote:
> On Mon, Mar 02, 2020 at 10:58:55AM +0000, John Garry wrote:
> > On 28/02/2020 09:33, Ming Lei wrote:
> >> scsi host template struct is quite big, and the following three
> >> fields are needed in SCSI IO path:
> >>
> >> - queuecommand
> >> - commit_rqs
> >> - cmd_size
> >
> > Would it have been nearly as good to reorganise Scsi host template
> > structure to ensure that these are adjacent?
> >
> > I say nearly, as it avoids the shost->hostt read.
>
> That would be worth trying. Replicating function pointers out of
> read-only data structures generally isn't a very good idea.
>

OK, I will try to re-organize host template and see if it can reach
same performance, but it still introduces one extra fetch in IO path.

BTW, we replicate function pointer in blk-mq too, such as q->mq_ops.

Thanks,
Ming