mbox series

[PATCHSET,v2,0/2] Add queue_is_busy helper

Message ID 20181108160609.27568-1-axboe@kernel.dk (mailing list archive)
Headers show
Series Add queue_is_busy helper | expand

Message

Jens Axboe Nov. 8, 2018, 4:06 p.m. UTC
DM currently uses atomic inc/dec to maintain a busy count of
IO on a given device. For the dm-mq path, we can replace this
with helper that just checks the state of the tags on the device.

First patch is a prep patch that allows the iteration helpers
to return true/false, like we support internally in sbitmap.
For a busy check we don't care about how many requests are
busy, just if some are or not. Hence we can stop iterating
tags as soon as we find one that is allocated.

Changes since v1:

- Remember to check if the queue matches, otherwise we could be
  returning false positive for shared tag sets.

 block/blk-mq-debugfs.c |  4 +++-
 block/blk-mq-tag.c     |  4 ++--
 block/blk-mq.c         | 42 +++++++++++++++++++++++++++++++++++++-----
 include/linux/blk-mq.h |  6 ++++--
 4 files changed, 46 insertions(+), 10 deletions(-)

Comments

jianchao.wang Nov. 9, 2018, 1:53 a.m. UTC | #1
Hi Jens

On 11/9/18 12:06 AM, Jens Axboe wrote:
> DM currently uses atomic inc/dec to maintain a busy count of
> IO on a given device. For the dm-mq path, we can replace this
> with helper that just checks the state of the tags on the device.
> 
> First patch is a prep patch that allows the iteration helpers
> to return true/false, like we support internally in sbitmap.
> For a busy check we don't care about how many requests are
> busy, just if some are or not. Hence we can stop iterating
> tags as soon as we find one that is allocated.

If we don't care about how many requests are busy, why not check
sb->map[idex].word directly ? It could be more efficient.

Thanks
Jianchao
jianchao.wang Nov. 9, 2018, 2:08 a.m. UTC | #2
On 11/9/18 9:53 AM, jianchao.wang wrote:
> Hi Jens
> 
> On 11/9/18 12:06 AM, Jens Axboe wrote:
>> DM currently uses atomic inc/dec to maintain a busy count of
>> IO on a given device. For the dm-mq path, we can replace this
>> with helper that just checks the state of the tags on the device.
>>
>> First patch is a prep patch that allows the iteration helpers
>> to return true/false, like we support internally in sbitmap.
>> For a busy check we don't care about how many requests are
>> busy, just if some are or not. Hence we can stop iterating
>> tags as soon as we find one that is allocated.
> 
> If we don't care about how many requests are busy, why not check
> sb->map[idex].word directly ? It could be more efficient.
> 

Oh, we need to check rq->q for the tag shared case.

> Thanks
> Jianchao
>