Thread (106 messages) 106 messages, 9 authors, 2021-09-28

Re: [PATCH 01/84] scsi: core: Use a member variable to track the SCSI command submitter

From: Benjamin Block <hidden>
Date: 2021-09-24 09:37:18

On Fri, Sep 17, 2021 at 05:04:44PM -0700, Bart Van Assche wrote:
quoted hunk ↗ jump to hunk
Conditional statements are faster than indirect calls. Use a member variable
to track the SCSI command submitter such that later patches can call
scsi_done(scmd) instead of scmd->scsi_done(scmd).

The asymmetric behavior that scsi_send_eh_cmnd() sets the submission
context to the SCSI error handler and that it does not restore the
submission context to the SCSI core is retained.

Cc: Hannes Reinecke <hare@suse.com>
Cc: Ming Lei <redacted>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_error.c | 18 +++++++-----------
 drivers/scsi/scsi_lib.c   |  9 +++++++++
 drivers/scsi/scsi_priv.h  |  1 +
 include/scsi/scsi_cmnd.h  |  7 +++++++
 4 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 572673873ddf..ba6d748a0246 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1577,6 +1577,15 @@ static blk_status_t scsi_prepare_cmd(struct request *req)
 
 static void scsi_mq_done(struct scsi_cmnd *cmd)
 {
+	switch (cmd->submitter) {
+	case BLOCK_LAYER:
+		break;
+	case SCSI_ERROR_HANDLER:
+		return scsi_eh_done(cmd);
+	case SCSI_RESET_IOCTL:
+		return;
+	}
+
Hmm, I'm confused, you replace one kind of branch with different one. Why
would that increase IOPS by 5%?

Maybe its because the new `submitter` field in `struct scsi_cmnd` is now
on a hot cache line, whereas `*scsi_done` is not?

-- 
Best Regards, Benjamin Block  / Linux on IBM Z Kernel Development / IBM Systems
IBM Deutschland Research & Development GmbH    /    https://www.ibm.com/privacy
Vorsitz. AufsR.: Gregor Pillen         /        Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: AmtsG Stuttgart, HRB 243294
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help