Skip to contentSkip to conversation

block: make the io_ticks counter more accurate

PATCH Superseded Wen Yang 2 participants 3 messages Dec 17, 2019 – Dec 20, 2019 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Wen Yang

author
#0 lore raw

PATCH 1/1 block: make the io_ticks counter more accurate

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

---
 block/blk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-core.c +1 -1
index 379f6f5..eb71873 100644
@@ -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));
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 2 lines · Wen Yang

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...

Signature · 1 line
Jens Axboe
author
#2 lore raw
Quoted 6 lines · Jens Axboe
Quoted 2 lines · Wen Yang

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.

block/blk-core.c +1 -1
index 379f6f5..da7de9f 100644
@@ -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