* [PATCH 0/4] blk-mq-tag: remove bt_for_each()
@ 2023-08-21 7:35 chengming.zhou
2023-08-21 7:35 ` [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter() chengming.zhou
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: chengming.zhou @ 2023-08-21 7:35 UTC (permalink / raw)
To: axboe, ming.lei, hch, bvanassche; +Cc: linux-block, linux-kernel, zhouchengming
From: Chengming Zhou <zhouchengming@bytedance.com>
There are two almost identical mechanisms in blk-mq-tag to iterate over
requests of one tags: bt_for_each() and the newer bt_tags_for_each().
This series aim to add support of queue filter in bt_tags_for_each()
then remove bt_for_each(). Fix and update documentation as we're here.
Thanks for review!
Chengming Zhou (4):
blk-mq-tag: support queue filter in bt_tags_iter()
blk-mq-tag: remove bt_for_each()
blk-mq: delete superfluous check in iterate callback
blk-mq-tag: update or fix functions documentation
block/blk-mq-tag.c | 176 ++++++++++++---------------------------------
block/blk-mq.c | 12 ++--
2 files changed, 49 insertions(+), 139 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter()
2023-08-21 7:35 [PATCH 0/4] blk-mq-tag: remove bt_for_each() chengming.zhou
@ 2023-08-21 7:35 ` chengming.zhou
2023-08-21 19:58 ` Bart Van Assche
2023-08-21 7:35 ` [PATCH 2/4] blk-mq-tag: remove bt_for_each() chengming.zhou
` (2 subsequent siblings)
3 siblings, 1 reply; 12+ messages in thread
From: chengming.zhou @ 2023-08-21 7:35 UTC (permalink / raw)
To: axboe, ming.lei, hch, bvanassche; +Cc: linux-block, linux-kernel, zhouchengming
From: Chengming Zhou <zhouchengming@bytedance.com>
The only user of bt_for_each() is blk_mq_queue_tag_busy_iter(), which
need to filter queue when iterate the tags. In preparation of removing
bt_for_each(), support queue filter in bt_tags_iter().
The new created __blk_mq_tagset_busy_iter() will be used by the next
patch to iterate requests of only one specified queue.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
block/blk-mq-tag.c | 45 ++++++++++++++++++++++++++++++---------------
1 file changed, 30 insertions(+), 15 deletions(-)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index cc57e2dd9a0b..75b33ae6acef 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -329,6 +329,7 @@ struct bt_tags_iter_data {
busy_tag_iter_fn *fn;
void *data;
unsigned int flags;
+ struct request_queue *q;
};
#define BT_TAG_ITER_RESERVED (1 << 0)
@@ -357,9 +358,13 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
if (!rq)
return true;
+ if (iter_data->q && iter_data->q != rq->q)
+ goto out;
+
if (!(iter_data->flags & BT_TAG_ITER_STARTED) ||
blk_mq_request_started(rq))
ret = iter_data->fn(rq, iter_data->data);
+out:
if (!iter_static_rqs)
blk_mq_put_rq_ref(rq);
return ret;
@@ -378,13 +383,15 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
* @flags: BT_TAG_ITER_*
*/
static void bt_tags_for_each(struct blk_mq_tags *tags, struct sbitmap_queue *bt,
- busy_tag_iter_fn *fn, void *data, unsigned int flags)
+ busy_tag_iter_fn *fn, void *data, unsigned int flags,
+ struct request_queue *q)
{
struct bt_tags_iter_data iter_data = {
.tags = tags,
.fn = fn,
.data = data,
.flags = flags,
+ .q = q,
};
if (tags->rqs)
@@ -392,14 +399,15 @@ static void bt_tags_for_each(struct blk_mq_tags *tags, struct sbitmap_queue *bt,
}
static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags,
- busy_tag_iter_fn *fn, void *priv, unsigned int flags)
+ busy_tag_iter_fn *fn, void *priv, unsigned int flags,
+ struct request_queue *q)
{
WARN_ON_ONCE(flags & BT_TAG_ITER_RESERVED);
if (tags->nr_reserved_tags)
bt_tags_for_each(tags, &tags->breserved_tags, fn, priv,
- flags | BT_TAG_ITER_RESERVED);
- bt_tags_for_each(tags, &tags->bitmap_tags, fn, priv, flags);
+ flags | BT_TAG_ITER_RESERVED, q);
+ bt_tags_for_each(tags, &tags->bitmap_tags, fn, priv, flags, q);
}
/**
@@ -417,7 +425,23 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags,
void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
void *priv)
{
- __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS);
+ __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS, NULL);
+}
+
+static void __blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
+ busy_tag_iter_fn *fn, void *priv,
+ struct request_queue *q)
+{
+ unsigned int flags = tagset->flags;
+ int i, nr_tags;
+
+ nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues;
+
+ for (i = 0; i < nr_tags; i++) {
+ if (tagset->tags && tagset->tags[i])
+ __blk_mq_all_tag_iter(tagset->tags[i], fn, priv,
+ BT_TAG_ITER_STARTED, q);
+ }
}
/**
@@ -436,16 +460,7 @@ void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
busy_tag_iter_fn *fn, void *priv)
{
- unsigned int flags = tagset->flags;
- int i, nr_tags;
-
- nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues;
-
- for (i = 0; i < nr_tags; i++) {
- if (tagset->tags && tagset->tags[i])
- __blk_mq_all_tag_iter(tagset->tags[i], fn, priv,
- BT_TAG_ITER_STARTED);
- }
+ __blk_mq_tagset_busy_iter(tagset, fn, priv, NULL);
}
EXPORT_SYMBOL(blk_mq_tagset_busy_iter);
--
2.41.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/4] blk-mq-tag: remove bt_for_each()
2023-08-21 7:35 [PATCH 0/4] blk-mq-tag: remove bt_for_each() chengming.zhou
2023-08-21 7:35 ` [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter() chengming.zhou
@ 2023-08-21 7:35 ` chengming.zhou
2023-08-21 21:26 ` Bart Van Assche
2023-08-21 7:35 ` [PATCH 3/4] blk-mq: delete superfluous check in iterate callback chengming.zhou
2023-08-21 7:35 ` [PATCH 4/4] blk-mq-tag: update or fix functions documentation chengming.zhou
3 siblings, 1 reply; 12+ messages in thread
From: chengming.zhou @ 2023-08-21 7:35 UTC (permalink / raw)
To: axboe, ming.lei, hch, bvanassche; +Cc: linux-block, linux-kernel, zhouchengming
From: Chengming Zhou <zhouchengming@bytedance.com>
Change the only user of bt_for_each() to use the new function
__blk_mq_tagset_busy_iter() -> bt_tags_for_each() and remove
bt_for_each().
There are some advantages:
1. less code to maintain, now only bt_tags_for_each() left.
2. __blk_mq_tagset_busy_iter() has BT_TAG_ITER_STARTED flag set, so only
started requests will be iterated, which should be more efficient.
Only one potential disadvantage I can see is that we lost the
blk_mq_hw_queue_mapped() filter, which maybe not happen for now?
Unmapped hctx was used to dynamically map or unmap when CPU hotplug,
but we don't do this anymore, we always map all possible CPUs now.
So it seems unmapped hctx may only happen if something wrong with
driver's tagset settings.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
block/blk-mq-tag.c | 99 +---------------------------------------------
1 file changed, 1 insertion(+), 98 deletions(-)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index 75b33ae6acef..c497d634cfdb 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -241,14 +241,6 @@ void blk_mq_put_tags(struct blk_mq_tags *tags, int *tag_array, int nr_tags)
tag_array, nr_tags);
}
-struct bt_iter_data {
- struct blk_mq_hw_ctx *hctx;
- struct request_queue *q;
- busy_tag_iter_fn *fn;
- void *data;
- bool reserved;
-};
-
static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags,
unsigned int bitnr)
{
@@ -263,67 +255,6 @@ static struct request *blk_mq_find_and_get_req(struct blk_mq_tags *tags,
return rq;
}
-static bool bt_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
-{
- struct bt_iter_data *iter_data = data;
- struct blk_mq_hw_ctx *hctx = iter_data->hctx;
- struct request_queue *q = iter_data->q;
- struct blk_mq_tag_set *set = q->tag_set;
- struct blk_mq_tags *tags;
- struct request *rq;
- bool ret = true;
-
- if (blk_mq_is_shared_tags(set->flags))
- tags = set->shared_tags;
- else
- tags = hctx->tags;
-
- if (!iter_data->reserved)
- bitnr += tags->nr_reserved_tags;
- /*
- * We can hit rq == NULL here, because the tagging functions
- * test and set the bit before assigning ->rqs[].
- */
- rq = blk_mq_find_and_get_req(tags, bitnr);
- if (!rq)
- return true;
-
- if (rq->q == q && (!hctx || rq->mq_hctx == hctx))
- ret = iter_data->fn(rq, iter_data->data);
- blk_mq_put_rq_ref(rq);
- return ret;
-}
-
-/**
- * bt_for_each - iterate over the requests associated with a hardware queue
- * @hctx: Hardware queue to examine.
- * @q: Request queue to examine.
- * @bt: sbitmap to examine. This is either the breserved_tags member
- * or the bitmap_tags member of struct blk_mq_tags.
- * @fn: Pointer to the function that will be called for each request
- * associated with @hctx that has been assigned a driver tag.
- * @fn will be called as follows: @fn(@hctx, rq, @data, @reserved)
- * where rq is a pointer to a request. Return true to continue
- * iterating tags, false to stop.
- * @data: Will be passed as third argument to @fn.
- * @reserved: Indicates whether @bt is the breserved_tags member or the
- * bitmap_tags member of struct blk_mq_tags.
- */
-static void bt_for_each(struct blk_mq_hw_ctx *hctx, struct request_queue *q,
- struct sbitmap_queue *bt, busy_tag_iter_fn *fn,
- void *data, bool reserved)
-{
- struct bt_iter_data iter_data = {
- .hctx = hctx,
- .fn = fn,
- .data = data,
- .reserved = reserved,
- .q = q,
- };
-
- sbitmap_for_each_set(&bt->sb, bt_iter, &iter_data);
-}
-
struct bt_tags_iter_data {
struct blk_mq_tags *tags;
busy_tag_iter_fn *fn;
@@ -519,35 +450,7 @@ void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn,
if (!percpu_ref_tryget(&q->q_usage_counter))
return;
- if (blk_mq_is_shared_tags(q->tag_set->flags)) {
- struct blk_mq_tags *tags = q->tag_set->shared_tags;
- struct sbitmap_queue *bresv = &tags->breserved_tags;
- struct sbitmap_queue *btags = &tags->bitmap_tags;
-
- if (tags->nr_reserved_tags)
- bt_for_each(NULL, q, bresv, fn, priv, true);
- bt_for_each(NULL, q, btags, fn, priv, false);
- } else {
- struct blk_mq_hw_ctx *hctx;
- unsigned long i;
-
- queue_for_each_hw_ctx(q, hctx, i) {
- struct blk_mq_tags *tags = hctx->tags;
- struct sbitmap_queue *bresv = &tags->breserved_tags;
- struct sbitmap_queue *btags = &tags->bitmap_tags;
-
- /*
- * If no software queues are currently mapped to this
- * hardware queue, there's nothing to check
- */
- if (!blk_mq_hw_queue_mapped(hctx))
- continue;
-
- if (tags->nr_reserved_tags)
- bt_for_each(hctx, q, bresv, fn, priv, true);
- bt_for_each(hctx, q, btags, fn, priv, false);
- }
- }
+ __blk_mq_tagset_busy_iter(q->tag_set, fn, priv, q);
blk_queue_exit(q);
}
--
2.41.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/4] blk-mq: delete superfluous check in iterate callback
2023-08-21 7:35 [PATCH 0/4] blk-mq-tag: remove bt_for_each() chengming.zhou
2023-08-21 7:35 ` [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter() chengming.zhou
2023-08-21 7:35 ` [PATCH 2/4] blk-mq-tag: remove bt_for_each() chengming.zhou
@ 2023-08-21 7:35 ` chengming.zhou
2023-08-21 21:29 ` Bart Van Assche
2023-08-21 7:35 ` [PATCH 4/4] blk-mq-tag: update or fix functions documentation chengming.zhou
3 siblings, 1 reply; 12+ messages in thread
From: chengming.zhou @ 2023-08-21 7:35 UTC (permalink / raw)
To: axboe, ming.lei, hch, bvanassche; +Cc: linux-block, linux-kernel, zhouchengming
From: Chengming Zhou <zhouchengming@bytedance.com>
The blk_mq_queue_tag_busy_iter() already has BT_TAG_ITER_STARTED flag
filter set, only started requests will be iterated over.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
block/blk-mq.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index f14b8669ac69..0b03963e0854 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -1496,19 +1496,15 @@ EXPORT_SYMBOL(blk_mq_delay_kick_requeue_list);
static bool blk_mq_rq_inflight(struct request *rq, void *priv)
{
+ bool *busy = priv;
+
/*
* If we find a request that isn't idle we know the queue is busy
* as it's checked in the iter.
* Return false to stop the iteration.
*/
- if (blk_mq_request_started(rq)) {
- bool *busy = priv;
-
- *busy = true;
- return false;
- }
-
- return true;
+ *busy = true;
+ return false;
}
bool blk_mq_queue_inflight(struct request_queue *q)
--
2.41.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 4/4] blk-mq-tag: update or fix functions documentation
2023-08-21 7:35 [PATCH 0/4] blk-mq-tag: remove bt_for_each() chengming.zhou
` (2 preceding siblings ...)
2023-08-21 7:35 ` [PATCH 3/4] blk-mq: delete superfluous check in iterate callback chengming.zhou
@ 2023-08-21 7:35 ` chengming.zhou
2023-08-21 21:32 ` Bart Van Assche
3 siblings, 1 reply; 12+ messages in thread
From: chengming.zhou @ 2023-08-21 7:35 UTC (permalink / raw)
To: axboe, ming.lei, hch, bvanassche; +Cc: linux-block, linux-kernel, zhouchengming
From: Chengming Zhou <zhouchengming@bytedance.com>
There are some misleading or wrong documentation in the functions of
blk-mq-tag, update it as we're here.
Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
block/blk-mq-tag.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c
index c497d634cfdb..611f52568964 100644
--- a/block/blk-mq-tag.c
+++ b/block/blk-mq-tag.c
@@ -307,11 +307,12 @@ static bool bt_tags_iter(struct sbitmap *bitmap, unsigned int bitnr, void *data)
* @bt: sbitmap to examine. This is either the breserved_tags member
* or the bitmap_tags member of struct blk_mq_tags.
* @fn: Pointer to the function that will be called for each started
- * request. @fn will be called as follows: @fn(rq, @data,
- * @reserved) where rq is a pointer to a request. Return true
- * to continue iterating tags, false to stop.
+ * request. @fn will be called as follows: @fn(rq, @data) where
+ * rq is a pointer to a request. Return true to continue iterating
+ * tags, false to stop.
* @data: Will be passed as second argument to @fn.
* @flags: BT_TAG_ITER_*
+ * @q: Only iterate over the requests of this queue.
*/
static void bt_tags_for_each(struct blk_mq_tags *tags, struct sbitmap_queue *bt,
busy_tag_iter_fn *fn, void *data, unsigned int flags,
@@ -345,10 +346,9 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags,
* blk_mq_all_tag_iter - iterate over all requests in a tag map
* @tags: Tag map to iterate over.
* @fn: Pointer to the function that will be called for each
- * request. @fn will be called as follows: @fn(rq, @priv,
- * reserved) where rq is a pointer to a request. 'reserved'
- * indicates whether or not @rq is a reserved request. Return
- * true to continue iterating tags, false to stop.
+ * request. @fn will be called as follows: @fn(rq, @priv)
+ * where rq is a pointer to a request. Return true to
+ * continue iterating tags, false to stop.
* @priv: Will be passed as second argument to @fn.
*
* Caller has to pass the tag map from which requests are allocated.
@@ -379,10 +379,9 @@ static void __blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
* blk_mq_tagset_busy_iter - iterate over all started requests in a tag set
* @tagset: Tag set to iterate over.
* @fn: Pointer to the function that will be called for each started
- * request. @fn will be called as follows: @fn(rq, @priv,
- * reserved) where rq is a pointer to a request. 'reserved'
- * indicates whether or not @rq is a reserved request. Return
- * true to continue iterating tags, false to stop.
+ * request. @fn will be called as follows: @fn(rq, @priv)
+ * where rq is a pointer to a request. Return true to
+ * continue iterating tags, false to stop.
* @priv: Will be passed as second argument to @fn.
*
* We grab one request reference before calling @fn and release it after
@@ -429,15 +428,12 @@ EXPORT_SYMBOL(blk_mq_tagset_wait_completed_request);
* blk_mq_queue_tag_busy_iter - iterate over all requests with a driver tag
* @q: Request queue to examine.
* @fn: Pointer to the function that will be called for each request
- * on @q. @fn will be called as follows: @fn(hctx, rq, @priv,
- * reserved) where rq is a pointer to a request and hctx points
- * to the hardware queue associated with the request. 'reserved'
- * indicates whether or not @rq is a reserved request.
- * @priv: Will be passed as third argument to @fn.
+ * on @q. @fn will be called as follows: @fn(rq, @priv) where rq
+ * is a pointer to a request.
+ * @priv: Will be passed as second argument to @fn.
*
* Note: if @q->tag_set is shared with other request queues then @fn will be
- * called for all requests on all queues that share that tag set and not only
- * for requests associated with @q.
+ * called only for requests associated with @q.
*/
void blk_mq_queue_tag_busy_iter(struct request_queue *q, busy_tag_iter_fn *fn,
void *priv)
--
2.41.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter()
2023-08-21 7:35 ` [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter() chengming.zhou
@ 2023-08-21 19:58 ` Bart Van Assche
2023-08-22 2:21 ` Chengming Zhou
0 siblings, 1 reply; 12+ messages in thread
From: Bart Van Assche @ 2023-08-21 19:58 UTC (permalink / raw)
To: chengming.zhou, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
> @@ -417,7 +425,23 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags,
> void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
> void *priv)
> {
> - __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS);
> + __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS, NULL);
> +}
> +
> +static void __blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
> + busy_tag_iter_fn *fn, void *priv,
> + struct request_queue *q)
> +{
> + unsigned int flags = tagset->flags;
> + int i, nr_tags;
> +
> + nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues;
> +
> + for (i = 0; i < nr_tags; i++) {
> + if (tagset->tags && tagset->tags[i])
> + __blk_mq_all_tag_iter(tagset->tags[i], fn, priv,
> + BT_TAG_ITER_STARTED, q);
> + }
> }
>
> /**
> @@ -436,16 +460,7 @@ void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
> void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
> busy_tag_iter_fn *fn, void *priv)
> {
> - unsigned int flags = tagset->flags;
> - int i, nr_tags;
> -
> - nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues;
> -
> - for (i = 0; i < nr_tags; i++) {
> - if (tagset->tags && tagset->tags[i])
> - __blk_mq_all_tag_iter(tagset->tags[i], fn, priv,
> - BT_TAG_ITER_STARTED);
> - }
> + __blk_mq_tagset_busy_iter(tagset, fn, priv, NULL);
> }
> EXPORT_SYMBOL(blk_mq_tagset_busy_iter);
One change per patch please. I think the introduction of __blk_mq_tagset_busy_iter()
should be a separate patch instead of happening in this patch.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] blk-mq-tag: remove bt_for_each()
2023-08-21 7:35 ` [PATCH 2/4] blk-mq-tag: remove bt_for_each() chengming.zhou
@ 2023-08-21 21:26 ` Bart Van Assche
2023-08-22 2:27 ` Chengming Zhou
0 siblings, 1 reply; 12+ messages in thread
From: Bart Van Assche @ 2023-08-21 21:26 UTC (permalink / raw)
To: chengming.zhou, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
> 2. __blk_mq_tagset_busy_iter() has BT_TAG_ITER_STARTED flag set, so only
> started requests will be iterated, which should be more efficient.
The above motivation sounds wrong to me. The goal here should be not to
change the behavior of blk_mq_queue_tag_busy_iter(). Although
blk_mq_queue_tag_busy_iter() iterates over more requests than only started
requests, apparently blk_mq_queue_tag_busy_iter() is only used to iterate
over started requests (blk_mq_request_started()). Please mention this in
the patch description.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 3/4] blk-mq: delete superfluous check in iterate callback
2023-08-21 7:35 ` [PATCH 3/4] blk-mq: delete superfluous check in iterate callback chengming.zhou
@ 2023-08-21 21:29 ` Bart Van Assche
0 siblings, 0 replies; 12+ messages in thread
From: Bart Van Assche @ 2023-08-21 21:29 UTC (permalink / raw)
To: chengming.zhou, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
>
> The blk_mq_queue_tag_busy_iter() already has BT_TAG_ITER_STARTED flag
> filter set, only started requests will be iterated over.
Please consider changing the description of this patch into something like
the following: "The previous patch in this series changed the behavior of
blk_mq_queue_tag_busy_iter() from iterating over all allocated tags into
iterating over started requests only. Leave out the code from
blk_mq_rq_inflight() that became superfluous because of this change."
Thanks,
Bart.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] blk-mq-tag: update or fix functions documentation
2023-08-21 7:35 ` [PATCH 4/4] blk-mq-tag: update or fix functions documentation chengming.zhou
@ 2023-08-21 21:32 ` Bart Van Assche
2023-08-22 2:36 ` Chengming Zhou
0 siblings, 1 reply; 12+ messages in thread
From: Bart Van Assche @ 2023-08-21 21:32 UTC (permalink / raw)
To: chengming.zhou, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
>
> There are some misleading or wrong documentation in the functions of
> blk-mq-tag, update it as we're here.
Are all changes in this patch updates for documentation that should have been
updated by commit 2dd6532e9591 ("blk-mq: Drop 'reserved' arg of busy_tag_iter_fn")?
If not, please move any unrelated changes into a separate patch.
Please also consider adding the following to this patch:
Fixes: 2dd6532e9591 ("blk-mq: Drop 'reserved' arg of busy_tag_iter_fn")
Thanks,
Bart.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter()
2023-08-21 19:58 ` Bart Van Assche
@ 2023-08-22 2:21 ` Chengming Zhou
0 siblings, 0 replies; 12+ messages in thread
From: Chengming Zhou @ 2023-08-22 2:21 UTC (permalink / raw)
To: Bart Van Assche, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 2023/8/22 03:58, Bart Van Assche wrote:
> On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
>> @@ -417,7 +425,23 @@ static void __blk_mq_all_tag_iter(struct blk_mq_tags *tags,
>> void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
>> void *priv)
>> {
>> - __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS);
>> + __blk_mq_all_tag_iter(tags, fn, priv, BT_TAG_ITER_STATIC_RQS, NULL);
>> +}
>> +
>> +static void __blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
>> + busy_tag_iter_fn *fn, void *priv,
>> + struct request_queue *q)
>> +{
>> + unsigned int flags = tagset->flags;
>> + int i, nr_tags;
>> +
>> + nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues;
>> +
>> + for (i = 0; i < nr_tags; i++) {
>> + if (tagset->tags && tagset->tags[i])
>> + __blk_mq_all_tag_iter(tagset->tags[i], fn, priv,
>> + BT_TAG_ITER_STARTED, q);
>> + }
>> }
>> /**
>> @@ -436,16 +460,7 @@ void blk_mq_all_tag_iter(struct blk_mq_tags *tags, busy_tag_iter_fn *fn,
>> void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset,
>> busy_tag_iter_fn *fn, void *priv)
>> {
>> - unsigned int flags = tagset->flags;
>> - int i, nr_tags;
>> -
>> - nr_tags = blk_mq_is_shared_tags(flags) ? 1 : tagset->nr_hw_queues;
>> -
>> - for (i = 0; i < nr_tags; i++) {
>> - if (tagset->tags && tagset->tags[i])
>> - __blk_mq_all_tag_iter(tagset->tags[i], fn, priv,
>> - BT_TAG_ITER_STARTED);
>> - }
>> + __blk_mq_tagset_busy_iter(tagset, fn, priv, NULL);
>> }
>> EXPORT_SYMBOL(blk_mq_tagset_busy_iter);
>
> One change per patch please. I think the introduction of __blk_mq_tagset_busy_iter()
> should be a separate patch instead of happening in this patch.
>
Yes, it's better. I will put it in a separate patch.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/4] blk-mq-tag: remove bt_for_each()
2023-08-21 21:26 ` Bart Van Assche
@ 2023-08-22 2:27 ` Chengming Zhou
0 siblings, 0 replies; 12+ messages in thread
From: Chengming Zhou @ 2023-08-22 2:27 UTC (permalink / raw)
To: Bart Van Assche, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 2023/8/22 05:26, Bart Van Assche wrote:
> On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
>> 2. __blk_mq_tagset_busy_iter() has BT_TAG_ITER_STARTED flag set, so only
>> started requests will be iterated, which should be more efficient.
>
> The above motivation sounds wrong to me. The goal here should be not to
> change the behavior of blk_mq_queue_tag_busy_iter(). Although
> blk_mq_queue_tag_busy_iter() iterates over more requests than only started
> requests, apparently blk_mq_queue_tag_busy_iter() is only used to iterate
> over started requests (blk_mq_request_started()). Please mention this in
> the patch description.
>
Ok, will do.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 4/4] blk-mq-tag: update or fix functions documentation
2023-08-21 21:32 ` Bart Van Assche
@ 2023-08-22 2:36 ` Chengming Zhou
0 siblings, 0 replies; 12+ messages in thread
From: Chengming Zhou @ 2023-08-22 2:36 UTC (permalink / raw)
To: Bart Van Assche, axboe, ming.lei, hch
Cc: linux-block, linux-kernel, zhouchengming
On 2023/8/22 05:32, Bart Van Assche wrote:
> On 8/21/23 00:35, chengming.zhou@linux.dev wrote:
>> From: Chengming Zhou <zhouchengming@bytedance.com>
>>
>> There are some misleading or wrong documentation in the functions of
>> blk-mq-tag, update it as we're here.
>
> Are all changes in this patch updates for documentation that should have been
> updated by commit 2dd6532e9591 ("blk-mq: Drop 'reserved' arg of busy_tag_iter_fn")?
> If not, please move any unrelated changes into a separate patch.
>
> Please also consider adding the following to this patch:
>
> Fixes: 2dd6532e9591 ("blk-mq: Drop 'reserved' arg of busy_tag_iter_fn")
>
Yes, most is related to that commit, will put into two patches.
Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-08-22 2:36 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21 7:35 [PATCH 0/4] blk-mq-tag: remove bt_for_each() chengming.zhou
2023-08-21 7:35 ` [PATCH 1/4] blk-mq-tag: support queue filter in bt_tags_iter() chengming.zhou
2023-08-21 19:58 ` Bart Van Assche
2023-08-22 2:21 ` Chengming Zhou
2023-08-21 7:35 ` [PATCH 2/4] blk-mq-tag: remove bt_for_each() chengming.zhou
2023-08-21 21:26 ` Bart Van Assche
2023-08-22 2:27 ` Chengming Zhou
2023-08-21 7:35 ` [PATCH 3/4] blk-mq: delete superfluous check in iterate callback chengming.zhou
2023-08-21 21:29 ` Bart Van Assche
2023-08-21 7:35 ` [PATCH 4/4] blk-mq-tag: update or fix functions documentation chengming.zhou
2023-08-21 21:32 ` Bart Van Assche
2023-08-22 2:36 ` Chengming Zhou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox