Commit 64bdcbc449105377dd60c8da97cfc1663b39562c
Committed by
Christoph Hellwig
1 parent
2eefd57b97
scsi: add use_cmd_list flag
Add a use_cmd_list flag in struct Scsi_Host to request keeping track of all outstanding commands per device. Default behaviour is not to keep track of cmd_list per sdev, as this may introduce lock contention. (overhead is more on multi-node NUMA.), and only enable it on the two drivers that need it. Signed-off-by: Kashyap Desai <kashyap.desai@avagotech.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Showing 4 changed files with 15 additions and 12 deletions Side-by-side Diff
drivers/scsi/aacraid/linit.c
drivers/scsi/dpt_i2o.c
drivers/scsi/scsi_lib.c
... | ... | @@ -645,16 +645,18 @@ |
645 | 645 | static void scsi_mq_uninit_cmd(struct scsi_cmnd *cmd) |
646 | 646 | { |
647 | 647 | struct scsi_device *sdev = cmd->device; |
648 | + struct Scsi_Host *shost = sdev->host; | |
648 | 649 | unsigned long flags; |
649 | 650 | |
650 | - BUG_ON(list_empty(&cmd->list)); | |
651 | - | |
652 | 651 | scsi_mq_free_sgtables(cmd); |
653 | 652 | scsi_uninit_cmd(cmd); |
654 | 653 | |
655 | - spin_lock_irqsave(&sdev->list_lock, flags); | |
656 | - list_del_init(&cmd->list); | |
657 | - spin_unlock_irqrestore(&sdev->list_lock, flags); | |
654 | + if (shost->use_cmd_list) { | |
655 | + BUG_ON(list_empty(&cmd->list)); | |
656 | + spin_lock_irqsave(&sdev->list_lock, flags); | |
657 | + list_del_init(&cmd->list); | |
658 | + spin_unlock_irqrestore(&sdev->list_lock, flags); | |
659 | + } | |
658 | 660 | } |
659 | 661 | |
660 | 662 | /* |
... | ... | @@ -1815,13 +1817,11 @@ |
1815 | 1817 | INIT_DELAYED_WORK(&cmd->abort_work, scmd_eh_abort_handler); |
1816 | 1818 | cmd->jiffies_at_alloc = jiffies; |
1817 | 1819 | |
1818 | - /* | |
1819 | - * XXX: cmd_list lookups are only used by two drivers, try to get | |
1820 | - * rid of this list in common code. | |
1821 | - */ | |
1822 | - spin_lock_irq(&sdev->list_lock); | |
1823 | - list_add_tail(&cmd->list, &sdev->cmd_list); | |
1824 | - spin_unlock_irq(&sdev->list_lock); | |
1820 | + if (shost->use_cmd_list) { | |
1821 | + spin_lock_irq(&sdev->list_lock); | |
1822 | + list_add_tail(&cmd->list, &sdev->cmd_list); | |
1823 | + spin_unlock_irq(&sdev->list_lock); | |
1824 | + } | |
1825 | 1825 | |
1826 | 1826 | sg = (void *)cmd + sizeof(struct scsi_cmnd) + shost->hostt->cmd_size; |
1827 | 1827 | cmd->sdb.table.sgl = sg; |