mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] block: make the io_ticks counter more accurate
@ 2019-12-17 14:28 Wen Yang
  2019-12-18  1:28 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Wen Yang @ 2019-12-17 14:28 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Joseph Qi, xlpang, Wen Yang, Mikulas Patocka, Mike Snitzer,
	linux-block, linux-kernel

Instead of the jiffies, we should update the io_ticks counter
with the passed in parameter 'now'.

Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Mikulas Patocka <mpatocka@redhat.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index 379f6f5..eb71873 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1365,7 +1365,7 @@ void blk_account_io_done(struct request *req, u64 now)
 		part_stat_lock();
 		part = req->part;
 
-		update_io_ticks(part, jiffies);
+		update_io_ticks(part, now);
 		part_stat_inc(part, ios[sgrp]);
 		part_stat_add(part, nsecs[sgrp], now - req->start_time_ns);
 		part_stat_add(part, time_in_queue, nsecs_to_jiffies64(now - req->start_time_ns));
-- 
1.8.3.1


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

* Re: [PATCH] block: make the io_ticks counter more accurate
  2019-12-17 14:28 [PATCH] block: make the io_ticks counter more accurate Wen Yang
@ 2019-12-18  1:28 ` Jens Axboe
  2019-12-20  6:16   ` Wen Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2019-12-18  1:28 UTC (permalink / raw)
  To: Wen Yang
  Cc: Joseph Qi, xlpang, Mikulas Patocka, Mike Snitzer, linux-block,
	linux-kernel

On 12/17/19 7:28 AM, Wen Yang wrote:
> Instead of the jiffies, we should update the io_ticks counter
> with the passed in parameter 'now'.

But they are not the same clock source...

-- 
Jens Axboe


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

* Re: [PATCH] block: make the io_ticks counter more accurate
  2019-12-18  1:28 ` Jens Axboe
@ 2019-12-20  6:16   ` Wen Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Wen Yang @ 2019-12-20  6:16 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Joseph Qi, xlpang, Mikulas Patocka, Mike Snitzer, linux-block,
	linux-kernel



On 2019/12/18 9:28 上午, Jens Axboe wrote:
> On 12/17/19 7:28 AM, Wen Yang wrote:
>> Instead of the jiffies, we should update the io_ticks counter
>> with the passed in parameter 'now'.
> 
> But they are not the same clock source...
> 

Hi Jens,
Thanks for your comments.
We plan to change it to the following version,
please kindly help with some suggestions.
Thank you.


diff --git a/block/blk-core.c b/block/blk-core.c
index 379f6f5..da7de9f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1365,7 +1365,7 @@ void blk_account_io_done(struct request *req, u64 now)
  		part_stat_lock();
  		part = req->part;

-		update_io_ticks(part, jiffies);
+		update_io_ticks(part, nsecs_to_jiffies(now));
  		part_stat_inc(part, ios[sgrp]);
  		part_stat_add(part, nsecs[sgrp], now - req->start_time_ns);
  		part_stat_add(part, time_in_queue, nsecs_to_jiffies64(now - 
req->start_time_ns));
@@ -1407,7 +1407,7 @@ void blk_account_io_start(struct request *rq, bool 
new_io)
  		rq->part = part;
  	}

-	update_io_ticks(part, jiffies);
+	update_io_ticks(part, nsecs_to_jiffies(ktime_get_ns()));

  	part_stat_unlock();
  }
--
1.8.3.1


--
Best Regards,
Wen


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

end of thread, other threads:[~2019-12-20  6:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-17 14:28 [PATCH] block: make the io_ticks counter more accurate Wen Yang
2019-12-18  1:28 ` Jens Axboe
2019-12-20  6:16   ` Wen Yang

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

all inboxes | Powered by JetHome®