From: Can Guo <cang@codeaurora.org>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
"James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
Jaegeuk Kim <jaegeuk@kernel.org>, Bean Huo <beanhuo@micron.com>,
Avri Altman <avri.altman@wdc.com>,
Asutosh Das <asutoshd@codeaurora.org>,
Vignesh Raghavendra <vigneshr@ti.com>,
linux-scsi@vger.kernel.org, Alim Akhtar <alim.akhtar@samsung.com>,
Stanley Chu <stanley.chu@mediatek.com>,
Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH] ufs: Increase the usable queue depth
Date: Fri, 14 May 2021 12:47:38 +0800 [thread overview]
Message-ID: <887cded6c85d422d1b30fd09427aa9a0@codeaurora.org> (raw)
In-Reply-To: <75c681d88b2e98a143ae601fbe895742@codeaurora.org>
On 2021-05-14 12:24, Can Guo wrote:
> On 2021-05-14 12:19, Bart Van Assche wrote:
>> On 5/13/21 9:04 PM, Can Guo wrote:
>>> Hi Bart,
>>>
>>> On 2021-05-14 00:49, Bart Van Assche wrote:
>>>> With the current implementation of the UFS driver active_queues is 1
>>>> instead of 0 if all UFS request queues are idle. That causes
>>>> hctx_may_queue() to divide the queue depth by 2 when queueing a
>>>> request
>>>> and hence reduces the usable queue depth.
>>>
>>> This is interesting. When all UFS queues are idle, in
>>> hctx_may_queue(),
>>> active_queues reads 1 (users == 1, depth == 32), where is it divided
>>> by 2?
>>>
>>> static inline bool hctx_may_queue(struct blk_mq_hw_ctx *hctx,
>>> struct sbitmap_queue *bt)
>>> {
>>> unsigned int depth, users;
>>>
>>> ....
>>> users = atomic_read(&hctx->tags->active_queues);
>>> }
>>>
>>> if (!users)
>>> return true;
>>>
>>> /*
>>> * Allow at least some tags
>>> */
>>> depth = max((bt->sb.depth + users - 1) / users, 4U);
>>> return __blk_mq_active_requests(hctx) < depth;
>>> }
>>
>> Hi Can,
>>
>> If no I/O scheduler has been configured then the active_queues counter
>> is increased from inside blk_get_request() by blk_mq_tag_busy() before
>> hctx_may_queue() is called. So if active_queues == 1 when the UFS
>> device
>> is idle, the active_queues counter will be increased to 2 if a request
>> is submitted to another request queue than hba->cmd_queue. This will
>> cause the hctx_may_queue() calls from inside __blk_mq_alloc_request()
>> and __blk_mq_get_driver_tag() to limit the queue depth to 32 / 2 = 16.
>>
>> If an I/O scheduler has been configured then __blk_mq_get_driver_tag()
>> will be the first function to call blk_mq_tag_busy() while processing
>> a
>> request. The hctx_may_queue() call in __blk_mq_get_driver_tag() will
>> limit the queue depth to 32 / 2 = 16 if an I/O scheduler has been
>> configured.
>>
>> Bart.
>
> Yes, I just figured out what you are saying from the commit message and
> gave my reviewed-by tag. Thanks for the explanation and the fix.
>
> Regards,
> Can Guo.
We definitely need to have fix present on Android12-5.10,
because performance may be impacted without it...
Thanks,
Can Guo.
next prev parent reply other threads:[~2021-05-14 4:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-13 16:49 [PATCH] ufs: Increase the usable queue depth Bart Van Assche
2021-05-14 4:04 ` Can Guo
2021-05-14 4:19 ` Bart Van Assche
2021-05-14 4:24 ` Can Guo
2021-05-14 4:47 ` Can Guo [this message]
2021-05-14 4:22 ` Can Guo
2021-05-15 3:13 ` Martin K. Petersen
2021-06-29 13:40 ` Can Guo
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=887cded6c85d422d1b30fd09427aa9a0@codeaurora.org \
--to=cang@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=alim.akhtar@samsung.com \
--cc=asutoshd@codeaurora.org \
--cc=avri.altman@wdc.com \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jaegeuk@kernel.org \
--cc=jejb@linux.vnet.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=stanley.chu@mediatek.com \
--cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.