diff mbox series

[v2] mpi3mr: a performance fix

Message ID 20240903144729.37218-1-thenzl@redhat.com
State New
Headers show
Series [v2] mpi3mr: a performance fix | expand

Commit Message

Tomas Henzl Sept. 3, 2024, 2:47 p.m. UTC
Commit 0c52310f2600 ("hrtimer: Ignore slack time for RT tasks in schedule_hrtimeout_range()")
effectivelly shortens a sleep in a polling function in the driver.
That is causing a performance regression as the new value
of just 2us is too low, in certain tests the perf drop is ~30%.
Fix this by adjusting the sleep to 20us (close to the previous value).

The '+1' added to the max parameter in usleep_range is there just
to silence static code analyzers like checkpatch.
 
Reported-by: Jan Jurca <jjurca@redhat.com>
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
V2: added a '+ 1' to silence checkpatch.
---
 drivers/scsi/mpi3mr/mpi3mr.h    | 2 +-
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Martin K. Petersen Sept. 13, 2024, 12:35 a.m. UTC | #1
Tomas,

> Commit 0c52310f2600 ("hrtimer: Ignore slack time for RT tasks in
> schedule_hrtimeout_range()") effectivelly shortens a sleep in a
> polling function in the driver. That is causing a performance
> regression as the new value of just 2us is too low, in certain tests
> the perf drop is ~30%. Fix this by adjusting the sleep to 20us (close
> to the previous value).

Applied to 6.12/scsi-staging, thanks!
Martin K. Petersen Sept. 19, 2024, 3:53 p.m. UTC | #2
On Tue, 03 Sep 2024 16:47:29 +0200, Tomas Henzl wrote:

> Commit 0c52310f2600 ("hrtimer: Ignore slack time for RT tasks in schedule_hrtimeout_range()")
> effectivelly shortens a sleep in a polling function in the driver.
> That is causing a performance regression as the new value
> of just 2us is too low, in certain tests the perf drop is ~30%.
> Fix this by adjusting the sleep to 20us (close to the previous value).
> 
> The '+1' added to the max parameter in usleep_range is there just
> to silence static code analyzers like checkpatch.
> 
> [...]

Applied to 6.12/scsi-queue, thanks!

[1/1] mpi3mr: a performance fix
      https://git.kernel.org/mkp/scsi/c/24d7071d9645
diff mbox series

Patch

diff --git a/drivers/scsi/mpi3mr/mpi3mr.h b/drivers/scsi/mpi3mr/mpi3mr.h
index dc2cdd5f0311..249c1a7285d6 100644
--- a/drivers/scsi/mpi3mr/mpi3mr.h
+++ b/drivers/scsi/mpi3mr/mpi3mr.h
@@ -178,7 +178,7 @@  extern atomic64_t event_counter;
 #define MPI3MR_DEFAULT_SDEV_QD	32
 
 /* Definitions for Threaded IRQ poll*/
-#define MPI3MR_IRQ_POLL_SLEEP			2
+#define MPI3MR_IRQ_POLL_SLEEP			20
 #define MPI3MR_IRQ_POLL_TRIGGER_IOCOUNT		8
 
 /* Definitions for the controller security status*/
diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index c196dc14ad20..5695c95fca15 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -710,7 +710,7 @@  static irqreturn_t mpi3mr_isr_poll(int irq, void *privdata)
 			    mpi3mr_process_op_reply_q(mrioc,
 				intr_info->op_reply_q);
 
-		usleep_range(MPI3MR_IRQ_POLL_SLEEP, 10 * MPI3MR_IRQ_POLL_SLEEP);
+		usleep_range(MPI3MR_IRQ_POLL_SLEEP, MPI3MR_IRQ_POLL_SLEEP + 1);
 
 	} while (atomic_read(&intr_info->op_reply_q->pend_ios) &&
 	    (num_op_reply < mrioc->max_host_ios));