From: Bart Van Assche Date: Wed, 13 Aug 2025 17:10:41 +0000 (-0700) Subject: scsi: ufs: core: Improve IOPS X-Git-Tag: v6.18-rc1~100^2~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc60a408a1dc29974bc82239b07b70c5f7fcfd31;p=thirdparty%2Fkernel%2Flinux.git scsi: ufs: core: Improve IOPS Measurements have shown that IOPS improve by 2% - 3% on my UFS 4 test setup every time a ktime_get() call is removed from the UFS driver command processing path. Hence this patch that modifies ufshcd_clk_scaling_start_busy() such that ktime_get() is only called if the returned value will be used. Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20250813171049.3399387-1-bvanassche@acm.org Reviewed-by: Bean Huo Reviewed-by: Peter Wang Signed-off-by: Martin K. Petersen --- diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 96ad57c3144b..daae452a1d25 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2230,11 +2230,13 @@ static void ufshcd_exit_clk_gating(struct ufs_hba *hba) static void ufshcd_clk_scaling_start_busy(struct ufs_hba *hba) { bool queue_resume_work = false; - ktime_t curr_t = ktime_get(); + ktime_t curr_t; if (!ufshcd_is_clkscaling_supported(hba)) return; + curr_t = ktime_get(); + guard(spinlock_irqsave)(&hba->clk_scaling.lock); if (!hba->clk_scaling.active_reqs++)