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 <[email protected]>
Cc: Omar Sandoval <[email protected]>,
Cc: "Martin K. Petersen" <[email protected]>,
Cc: James Bottomley <[email protected]>,
Cc: Christoph Hellwig <[email protected]>,
Cc: Don Brace <[email protected]>
Cc: Kashyap Desai <[email protected]>
Cc: Peter Rivera <[email protected]>
Cc: Laurence Oberman <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Mike Snitzer <[email protected]>
Signed-off-by: Ming Lei <[email protected]>
---
 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