It is observed on null_blk that IOPS can be improved much by simply making
hw queue per NUMA node, so this patch applies the introduced .host_tagset
for improving performance.

In reality, .can_queue is quite big, and NUMA node number is often small, so
each hw queue's depth should be high enough to saturate device.

Cc: Arun Easi <arun.e...@cavium.com>
Cc: Omar Sandoval <osan...@fb.com>,
Cc: "Martin K. Petersen" <martin.peter...@oracle.com>,
Cc: James Bottomley <james.bottom...@hansenpartnership.com>,
Cc: Christoph Hellwig <h...@lst.de>,
Cc: Don Brace <don.br...@microsemi.com>
Cc: Kashyap Desai <kashyap.de...@broadcom.com>
Cc: Peter Rivera <peter.riv...@broadcom.com>
Cc: Laurence Oberman <lober...@redhat.com>
Cc: Hannes Reinecke <h...@suse.de>
Cc: Mike Snitzer <snit...@redhat.com>
Signed-off-by: Ming Lei <ming....@redhat.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 065956cb2aeb..0b46f97cbfdb 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3177,6 +3177,7 @@ static struct scsi_host_template megasas_template = {
        .use_clustering = ENABLE_CLUSTERING,
        .change_queue_depth = scsi_change_queue_depth,
        .no_write_same = 1,
+       .host_tagset = 1,
 };
 
 /**
@@ -5947,6 +5948,8 @@ static int megasas_start_aen(struct megasas_instance 
*instance)
 static int megasas_io_attach(struct megasas_instance *instance)
 {
        struct Scsi_Host *host = instance->host;
+       /* 256 tags should be high enough to saturate device */
+       int max_queues = DIV_ROUND_UP(host->can_queue, 256);
 
        /*
         * Export parameters required by SCSI mid-layer
@@ -5987,6 +5990,9 @@ static int megasas_io_attach(struct megasas_instance 
*instance)
        host->max_lun = MEGASAS_MAX_LUN;
        host->max_cmd_len = 16;
 
+       /* per NUMA node hw queue */
+       host->nr_hw_queues = min_t(int, nr_node_ids, max_queues);
+
        /*
         * Notify the mid-layer about the new controller
         */
-- 
2.9.5

Reply via email to