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

Bart Van Assche
2020-03-02T04:32:56Z

On 2020-02-28 01: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
>
> Cache them into scsi host intance, so that we can avoid to fetch
> big scsi host template instance in IO path.
>
> 40% IOPS boost can be observed in my scsi_debug performance test after
> applying this change.
>
> Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com>
> Cc: Ewan D . Milne <emilne@redhat.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Christoph Hellwig <hch@lst.de>

Please use my current email address instead of the above old and no
longer valid email address. See also the .mailmap file. I think I have
asked this before.

> @@ -1148,7 +1148,7 @@ void scsi_init_command(struct scsi_device *dev, struct scsi_cmnd *cmd)
> in_flight = test_bit(SCMD_STATE_INFLIGHT, &cmd->state);
> /* zero out the cmd, except for the embedded scsi_request */
> memset((char *)cmd + sizeof(cmd->req), 0,
> - sizeof(*cmd) - sizeof(cmd->req) + dev->host->hostt->cmd_size);
> + sizeof(*cmd) - sizeof(cmd->req) + dev->host->cmd_size);
>
> cmd->device = dev;
> cmd->sense_buffer = buf;

This patch does not apply on Martin's 5.7/scsi-queue branch. Please rebase.

Thanks,

Bart.