public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blk-iocost: fix queue stats accounting
@ 2023-08-04  7:06 chengming.zhou
  2023-08-07 18:35 ` Tejun Heo
  2023-08-08 21:42 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: chengming.zhou @ 2023-08-04  7:06 UTC (permalink / raw)
  To: tj, axboe, josef; +Cc: linux-block, linux-kernel, zhouchengming

From: Chengming Zhou <zhouchengming@bytedance.com>

The q->stats->accounting is not only used by iocost, but iocost only
increase this counter, never decrease it. So queue stats accounting
will always enabled after using iocost once.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 block/blk-iocost.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-iocost.c b/block/blk-iocost.c
index dd64e2066f01..089fcb9cfce3 100644
--- a/block/blk-iocost.c
+++ b/block/blk-iocost.c
@@ -3301,11 +3301,12 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
 	if (qos[QOS_MIN] > qos[QOS_MAX])
 		goto einval;
 
-	if (enable) {
+	if (enable && !ioc->enabled) {
 		blk_stat_enable_accounting(disk->queue);
 		blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
 		ioc->enabled = true;
-	} else {
+	} else if (!enable && ioc->enabled) {
+		blk_stat_disable_accounting(disk->queue);
 		blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
 		ioc->enabled = false;
 	}
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-iocost: fix queue stats accounting
  2023-08-04  7:06 [PATCH] blk-iocost: fix queue stats accounting chengming.zhou
@ 2023-08-07 18:35 ` Tejun Heo
  2023-08-08 21:42 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2023-08-07 18:35 UTC (permalink / raw)
  To: chengming.zhou; +Cc: axboe, josef, linux-block, linux-kernel, zhouchengming

On Fri, Aug 04, 2023 at 03:06:09PM +0800, chengming.zhou@linux.dev wrote:
> From: Chengming Zhou <zhouchengming@bytedance.com>
> 
> The q->stats->accounting is not only used by iocost, but iocost only
> increase this counter, never decrease it. So queue stats accounting
> will always enabled after using iocost once.
> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-iocost: fix queue stats accounting
  2023-08-04  7:06 [PATCH] blk-iocost: fix queue stats accounting chengming.zhou
  2023-08-07 18:35 ` Tejun Heo
@ 2023-08-08 21:42 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2023-08-08 21:42 UTC (permalink / raw)
  To: tj, josef, chengming.zhou; +Cc: linux-block, linux-kernel, zhouchengming


On Fri, 04 Aug 2023 15:06:09 +0800, chengming.zhou@linux.dev wrote:
> The q->stats->accounting is not only used by iocost, but iocost only
> increase this counter, never decrease it. So queue stats accounting
> will always enabled after using iocost once.
> 
> 

Applied, thanks!

[1/1] blk-iocost: fix queue stats accounting
      commit: c992226e984b93b316005ae4b12f2dce1e11630c

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-08 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04  7:06 [PATCH] blk-iocost: fix queue stats accounting chengming.zhou
2023-08-07 18:35 ` Tejun Heo
2023-08-08 21:42 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox