mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wen Yang <wenyang@linux.alibaba.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>,
	xlpang@linux.alibaba.com, Mikulas Patocka <mpatocka@redhat.com>,
	Mike Snitzer <snitzer@redhat.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] block: make the io_ticks counter more accurate
Date: Fri, 20 Dec 2019 14:16:38 +0800	[thread overview]
Message-ID: <9e2de812-4ca7-3560-08ea-a346944c05d6@linux.alibaba.com> (raw)
In-Reply-To: <658ba1d9-45b3-db85-250d-7a1a9328e9ff@kernel.dk>



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


      reply	other threads:[~2019-12-20  6:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 14:28 Wen Yang
2019-12-18  1:28 ` Jens Axboe
2019-12-20  6:16   ` Wen Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e2de812-4ca7-3560-08ea-a346944c05d6@linux.alibaba.com \
    --to=wenyang@linux.alibaba.com \
    --cc=axboe@kernel.dk \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@redhat.com \
    --cc=xlpang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®