mpt2sas: Add free smids to the head, not tail of list

Reusing a smid quickly means it's still cache-hot.  This yields a small
but noticable performance improvement in a well-known database benchmark.
This improvement is already present in the mpt3sas driver.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
Reviewed-by: Praveen Krishnamoorthy <Praveen.krishnamoorthy@lsi.com>
Acked-by: Sreekanth Reddy <Sreekanth.reddy@lsi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Matthew Wilcox 2014-03-27 16:40:34 -04:00 committed by Christoph Hellwig
parent 90f951edb7
commit 049b3e81d7
1 changed files with 4 additions and 4 deletions

View File

@ -1739,14 +1739,14 @@ mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid)
list_for_each_entry_safe(chain_req, next, list_for_each_entry_safe(chain_req, next,
&ioc->scsi_lookup[i].chain_list, tracker_list) { &ioc->scsi_lookup[i].chain_list, tracker_list) {
list_del_init(&chain_req->tracker_list); list_del_init(&chain_req->tracker_list);
list_add_tail(&chain_req->tracker_list, list_add(&chain_req->tracker_list,
&ioc->free_chain_list); &ioc->free_chain_list);
} }
} }
ioc->scsi_lookup[i].cb_idx = 0xFF; ioc->scsi_lookup[i].cb_idx = 0xFF;
ioc->scsi_lookup[i].scmd = NULL; ioc->scsi_lookup[i].scmd = NULL;
ioc->scsi_lookup[i].direct_io = 0; ioc->scsi_lookup[i].direct_io = 0;
list_add_tail(&ioc->scsi_lookup[i].tracker_list, list_add(&ioc->scsi_lookup[i].tracker_list,
&ioc->free_list); &ioc->free_list);
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
@ -1764,13 +1764,13 @@ mpt2sas_base_free_smid(struct MPT2SAS_ADAPTER *ioc, u16 smid)
/* hi-priority */ /* hi-priority */
i = smid - ioc->hi_priority_smid; i = smid - ioc->hi_priority_smid;
ioc->hpr_lookup[i].cb_idx = 0xFF; ioc->hpr_lookup[i].cb_idx = 0xFF;
list_add_tail(&ioc->hpr_lookup[i].tracker_list, list_add(&ioc->hpr_lookup[i].tracker_list,
&ioc->hpr_free_list); &ioc->hpr_free_list);
} else if (smid <= ioc->hba_queue_depth) { } else if (smid <= ioc->hba_queue_depth) {
/* internal queue */ /* internal queue */
i = smid - ioc->internal_smid; i = smid - ioc->internal_smid;
ioc->internal_lookup[i].cb_idx = 0xFF; ioc->internal_lookup[i].cb_idx = 0xFF;
list_add_tail(&ioc->internal_lookup[i].tracker_list, list_add(&ioc->internal_lookup[i].tracker_list,
&ioc->internal_free_list); &ioc->internal_free_list);
} }
spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags); spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);