Skip to content

Commit f39e5e5

Browse files
cp890582martinkpetersen
authored andcommitted
scsi: megaraid_sas: Use high IOPS queues based on IO workload
The driver will use round-robin method for IO submission in batches within the high IOPS queues when the number of in-flight ios on the target device is larger than 8. Otherwise the driver will use low latency reply queues. Signed-off-by: Kashyap Desai <[email protected]> Signed-off-by: Chandrakanth Patil <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f0b9e7b commit f39e5e5

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

drivers/scsi/megaraid/megaraid_sas.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,8 @@ enum MR_PD_TYPE {
22532253

22542254
/*Aero performance parameters*/
22552255
#define MR_HIGH_IOPS_QUEUE_COUNT 8
2256+
#define MR_DEVICE_HIGH_IOPS_DEPTH 8
2257+
#define MR_HIGH_IOPS_BATCH_COUNT 16
22562258

22572259
struct megasas_instance {
22582260

@@ -2362,6 +2364,7 @@ struct megasas_instance {
23622364
atomic_t ldio_outstanding;
23632365
atomic_t fw_reset_no_pci_access;
23642366
atomic64_t total_io_count;
2367+
atomic64_t high_iops_outstanding;
23652368

23662369
struct megasas_instance_template *instancet;
23672370
struct tasklet_struct isr_tasklet;

drivers/scsi/megaraid/megaraid_sas_fp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ MR_BuildRaidContext(struct megasas_instance *instance,
10381038
stripSize = 1 << raid->stripeShift;
10391039
stripe_mask = stripSize-1;
10401040

1041+
io_info->data_arms = raid->rowDataSize;
10411042

10421043
/*
10431044
* calculate starting row and stripe, and number of strips and rows

drivers/scsi/megaraid/megaraid_sas_fusion.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,6 +2811,7 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
28112811
io_info.r1_alt_dev_handle = MR_DEVHANDLE_INVALID;
28122812
scsi_buff_len = scsi_bufflen(scp);
28132813
io_request->DataLength = cpu_to_le32(scsi_buff_len);
2814+
io_info.data_arms = 1;
28142815

28152816
if (scp->sc_data_direction == DMA_FROM_DEVICE)
28162817
io_info.isRead = 1;
@@ -2830,7 +2831,13 @@ megasas_build_ldio_fusion(struct megasas_instance *instance,
28302831
fp_possible = (io_info.fpOkForIo > 0) ? true : false;
28312832
}
28322833

2833-
if (instance->msix_load_balance)
2834+
if (instance->balanced_mode &&
2835+
atomic_read(&scp->device->device_busy) >
2836+
(io_info.data_arms * MR_DEVICE_HIGH_IOPS_DEPTH))
2837+
cmd->request_desc->SCSIIO.MSIxIndex =
2838+
mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) /
2839+
MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start);
2840+
else if (instance->msix_load_balance)
28342841
cmd->request_desc->SCSIIO.MSIxIndex =
28352842
(mega_mod64(atomic64_add_return(1, &instance->total_io_count),
28362843
instance->msix_vectors));
@@ -3157,7 +3164,12 @@ megasas_build_syspd_fusion(struct megasas_instance *instance,
31573164

31583165
cmd->request_desc->SCSIIO.DevHandle = io_request->DevHandle;
31593166

3160-
if (instance->msix_load_balance)
3167+
if (instance->balanced_mode &&
3168+
atomic_read(&scmd->device->device_busy) > MR_DEVICE_HIGH_IOPS_DEPTH)
3169+
cmd->request_desc->SCSIIO.MSIxIndex =
3170+
mega_mod64((atomic64_add_return(1, &instance->high_iops_outstanding) /
3171+
MR_HIGH_IOPS_BATCH_COUNT), instance->low_latency_index_start);
3172+
else if (instance->msix_load_balance)
31613173
cmd->request_desc->SCSIIO.MSIxIndex =
31623174
(mega_mod64(atomic64_add_return(1, &instance->total_io_count),
31633175
instance->msix_vectors));

drivers/scsi/megaraid/megaraid_sas_fusion.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ struct IO_REQUEST_INFO {
962962
u8 pd_after_lb;
963963
u16 r1_alt_dev_handle; /* raid 1/10 only */
964964
bool ra_capable;
965+
u8 data_arms;
965966
};
966967

967968
struct MR_LD_TARGET_SYNC {

0 commit comments

Comments
 (0)