Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: "Peter Wang (王信友)" <peter.wang@mediatek.com>
To: "bvanassche@acm.org" <bvanassche@acm.org>,
	"martin.petersen@oracle.com" <martin.petersen@oracle.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	"beanhuo@micron.com" <beanhuo@micron.com>,
	"mani@kernel.org" <mani@kernel.org>,
	"avri.altman@sandisk.com" <avri.altman@sandisk.com>,
	"James.Bottomley@HansenPartnership.com"
	<James.Bottomley@HansenPartnership.com>,
	"quic_nguyenb@quicinc.com" <quic_nguyenb@quicinc.com>,
	"adrian.hunter@intel.com" <adrian.hunter@intel.com>
Subject: Re: [PATCH] ufs: core: Improve IOPS
Date: Thu, 14 Aug 2025 08:28:38 +0000	[thread overview]
Message-ID: <6413b3a930b073440793f2dd1578dd2ec8bd7b18.camel@mediatek.com> (raw)
In-Reply-To: <20250813171049.3399387-1-bvanassche@acm.org>

On Wed, 2025-08-13 at 10:10 -0700, Bart Van Assche wrote:
> 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 <bvanassche@acm.org>
> ---
>  drivers/ufs/core/ufshcd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index b20f262fc8e4..9579e2481062 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -2231,11 +2231,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++)

Hi Bart,

Although this may not cause any errors, it is clearly a 
coding defect that impacts performance.
Have you considered adding a "Fixes" and "Cc" tag to 
address this issue?

Thanks.
Peter



  reply	other threads:[~2025-08-14  8:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-13 17:10 [PATCH] ufs: core: Improve IOPS Bart Van Assche
2025-08-14  8:28 ` Peter Wang (王信友) [this message]
2025-08-14 15:48   ` Bart Van Assche
2025-08-15  6:21     ` Peter Wang (王信友)
2025-08-14  9:02 ` Bean Huo
2025-08-19  2:00 ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6413b3a930b073440793f2dd1578dd2ec8bd7b18.camel@mediatek.com \
    --to=peter.wang@mediatek.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@sandisk.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=quic_nguyenb@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox