From: Bart Van Assche <bvanassche@acm.org>
To: Wang Jianzheng <wangjianzheng@vivo.com>,
Jens Axboe <axboe@kernel.dk>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Peter Wang <peter.wang@mediatek.com>,
Bean Huo <beanhuo@micron.com>,
"Bao D. Nguyen" <quic_nguyenb@quicinc.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 2/3] block: add support for device frequency PM QoS tuning
Date: Mon, 15 Sep 2025 14:26:34 -0700 [thread overview]
Message-ID: <191ca54f-0faa-4615-967a-7b4c86d59e0e@acm.org> (raw)
In-Reply-To: <20250914114549.650671-3-wangjianzheng@vivo.com>
On 9/14/25 4:45 AM, Wang Jianzheng wrote:
> +#ifdef CONFIG_PM
> +static void blk_mq_dev_frequency_work(struct work_struct *work)
> +{
> + struct request_queue *q =
> + container_of(work, struct request_queue, dev_freq_work.work);
> + unsigned long timeout;
> + struct dev_pm_qos_request *qos = q->dev_freq_qos;
> +
> + timeout = msecs_to_jiffies(q->disk->dev_freq_timeout);
> + if (!q || IS_ERR_OR_NULL(q->dev) || IS_ERR_OR_NULL(qos))
> + return;
> +
> + if (q->pm_qos_status == PM_QOS_ACTIVE) {
> + q->pm_qos_status = PM_QOS_FREQ_SET;
> + dev_pm_qos_add_request(q->dev, qos, DEV_PM_QOS_MIN_FREQUENCY,
> + FREQ_QOS_MAX_DEFAULT_VALUE);
> + } else {
> + if (time_after(jiffies, READ_ONCE(q->last_active) + timeout))
> + q->pm_qos_status = PM_QOS_FREQ_REMOV;
> + }
> +
> + if (q->pm_qos_status == PM_QOS_FREQ_REMOV) {
> + dev_pm_qos_remove_request(qos);
> + q->pm_qos_status = PM_QOS_ACTIVE;
> + } else {
> + schedule_delayed_work(&q->dev_freq_work,
> + q->last_active + timeout - jiffies);
> + }
> +}
The above code is similar in nature to the activity detection by the
run-time power management (RPM) code. Why a new timer mechanism instead
of adding more code in the UFS driver RPM callbacks?
> @@ -3161,6 +3211,8 @@ void blk_mq_submit_bio(struct bio *bio)
> goto queue_exit;
> }
>
> + blk_pm_qos_dev_freq_update(q, bio);
Good luck with adding power-management code in the block layer hot path
... I'm not sure anyone will be enthusiast seeing code being added in
blk_mq_submit_bio().
Thanks,
Bart.
next prev parent reply other threads:[~2025-09-15 21:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-14 11:45 [PATCH 0/3] block: " Wang Jianzheng
2025-09-14 11:45 ` [PATCH 1/3] block/genhd: add sysfs knobs for the device frequency PM QoS Wang Jianzheng
2025-09-15 21:15 ` Bart Van Assche
2025-09-14 11:45 ` [PATCH 2/3] block: add support for device frequency PM QoS tuning Wang Jianzheng
2025-09-15 21:26 ` Bart Van Assche [this message]
2025-09-14 11:45 ` [PATCH 3/3] scsi: ufs: core: Add support for " Wang Jianzheng
2025-09-15 21:20 ` Bart Van Assche
2025-09-15 21:13 ` [PATCH 0/3] block: device " Bart Van Assche
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=191ca54f-0faa-4615-967a-7b4c86d59e0e@acm.org \
--to=bvanassche@acm.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=axboe@kernel.dk \
--cc=beanhuo@micron.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=peter.wang@mediatek.com \
--cc=quic_nguyenb@quicinc.com \
--cc=rafael@kernel.org \
--cc=wangjianzheng@vivo.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
all inboxes | Powered by JetHome®