* [PATCH] blk-mq: Swap two calls in blk_mq_exit_queue()
@ 2021-05-13 17:15 Bart Van Assche
2021-05-14 0:55 ` Ming Lei
2021-05-14 14:59 ` Jens Axboe
0 siblings, 2 replies; 3+ messages in thread
From: Bart Van Assche @ 2021-05-13 17:15 UTC (permalink / raw)
To: Jens Axboe
Cc: linux-block, Christoph Hellwig, Bart Van Assche,
Christoph Hellwig, Ming Lei, Hannes Reinecke
If a tag set is shared across request queues (e.g. SCSI LUNs) then the
block layer core keeps track of the number of active request queues in
tags->active_queues. blk_mq_tag_busy() and blk_mq_tag_idle() update that
atomic counter if the hctx flag BLK_MQ_F_TAG_QUEUE_SHARED is set. Make
sure that blk_mq_exit_queue() calls blk_mq_tag_idle() before that flag is
cleared by blk_mq_del_queue_tag_set().
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Fixes: 0d2602ca30e4 ("blk-mq: improve support for shared tags maps")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
block/blk-mq.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 1ea012de60eb..96b8e3164835 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3289,10 +3289,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue);
/* tags can _not_ be used after returning from blk_mq_exit_queue */
void blk_mq_exit_queue(struct request_queue *q)
{
- struct blk_mq_tag_set *set = q->tag_set;
+ struct blk_mq_tag_set *set = q->tag_set;
- blk_mq_del_queue_tag_set(q);
+ /* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */
blk_mq_exit_hw_queues(q, set, set->nr_hw_queues);
+ /* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */
+ blk_mq_del_queue_tag_set(q);
}
static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] blk-mq: Swap two calls in blk_mq_exit_queue()
2021-05-13 17:15 [PATCH] blk-mq: Swap two calls in blk_mq_exit_queue() Bart Van Assche
@ 2021-05-14 0:55 ` Ming Lei
2021-05-14 14:59 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2021-05-14 0:55 UTC (permalink / raw)
To: Bart Van Assche
Cc: Jens Axboe, linux-block, Christoph Hellwig, Christoph Hellwig,
Hannes Reinecke
On Thu, May 13, 2021 at 10:15:29AM -0700, Bart Van Assche wrote:
> If a tag set is shared across request queues (e.g. SCSI LUNs) then the
> block layer core keeps track of the number of active request queues in
> tags->active_queues. blk_mq_tag_busy() and blk_mq_tag_idle() update that
> atomic counter if the hctx flag BLK_MQ_F_TAG_QUEUE_SHARED is set. Make
> sure that blk_mq_exit_queue() calls blk_mq_tag_idle() before that flag is
> cleared by blk_mq_del_queue_tag_set().
>
> Cc: Christoph Hellwig <hch@infradead.org>
> Cc: Ming Lei <ming.lei@redhat.com>
> Cc: Hannes Reinecke <hare@suse.com>
> Fixes: 0d2602ca30e4 ("blk-mq: improve support for shared tags maps")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> block/blk-mq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index 1ea012de60eb..96b8e3164835 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -3289,10 +3289,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue);
> /* tags can _not_ be used after returning from blk_mq_exit_queue */
> void blk_mq_exit_queue(struct request_queue *q)
> {
> - struct blk_mq_tag_set *set = q->tag_set;
> + struct blk_mq_tag_set *set = q->tag_set;
>
> - blk_mq_del_queue_tag_set(q);
> + /* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */
> blk_mq_exit_hw_queues(q, set, set->nr_hw_queues);
> + /* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */
> + blk_mq_del_queue_tag_set(q);
> }
>
> static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
>
Looks fine:
Reviewed-by: Ming Lei <ming.lei@redhat.com>
--
Ming
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] blk-mq: Swap two calls in blk_mq_exit_queue()
2021-05-13 17:15 [PATCH] blk-mq: Swap two calls in blk_mq_exit_queue() Bart Van Assche
2021-05-14 0:55 ` Ming Lei
@ 2021-05-14 14:59 ` Jens Axboe
1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2021-05-14 14:59 UTC (permalink / raw)
To: Bart Van Assche
Cc: linux-block, Christoph Hellwig, Christoph Hellwig, Ming Lei,
Hannes Reinecke
On 5/13/21 11:15 AM, Bart Van Assche wrote:
> If a tag set is shared across request queues (e.g. SCSI LUNs) then the
> block layer core keeps track of the number of active request queues in
> tags->active_queues. blk_mq_tag_busy() and blk_mq_tag_idle() update that
> atomic counter if the hctx flag BLK_MQ_F_TAG_QUEUE_SHARED is set. Make
> sure that blk_mq_exit_queue() calls blk_mq_tag_idle() before that flag is
> cleared by blk_mq_del_queue_tag_set().
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-14 14:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-13 17:15 [PATCH] blk-mq: Swap two calls in blk_mq_exit_queue() Bart Van Assche
2021-05-14 0:55 ` Ming Lei
2021-05-14 14:59 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).