Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9320343ybl; Wed, 25 Dec 2019 19:12:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzfjf88sVFgwFk2jIPPmOg6Zk+DxWwrKzHeJe8VQnDY1c8iARGLFZxtKRF2J3fyAPx/AS3r X-Received: by 2002:a9d:6516:: with SMTP id i22mr30148797otl.94.1577329947783; Wed, 25 Dec 2019 19:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577329947; cv=none; d=google.com; s=arc-20160816; b=CA2mSaQo0089bdf4V/v0RppfrXpZzDKTiuV+YFoyIigjydpKpmH0GzaxsvXOoNF6cP tVPPVtlvuV8yuL5IDHKUl+Q82HVT/zSTvMsKuDwg0uZjDt5YQWQKGPsOflt0snvRc2cC dAKePWbembEyJ86dFrLoe2WPfYY962Tn7jRrLuJ65PA8jKcNmywi0CTVmLs3lDxuTb4n smfpcca1DA+hBsj+60fSWLO7x8ls1DhYR90D01R/+KbQXtju68/FuEN7tGCZ02tsZYBs KmlyH4dATQWapz3vaU3I1Y05RwsL6/TrIKbOoXjvwrYWbvm2p7KU9h+BX47DrLGORQof 1eVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=AmUAvILogTCL2ziOMbp3MdZ/EseC4N3C3tzmAMV5WYE=; b=hurTlvgdzyvL445dne9q7366yvx2NdHAnC9ywXnM0lbCcz2tp81aJ+eufbCv9ZiFIb r5HME9wJSRqmEpc9EdlYn/BZvMz+/McWBUR5ifNdMRaaAasmTKAcLUGPKG4lfzVc9y63 a6YfqUt3jd2NrdhocuqvVnWir+mSs10rfCI03jTyavzjqSly3kBsbt80HrK+ZPej4X4S 053I3+fHX35jfq+RQAGasvxddqeElJssu8V3gnYb1Si8DNkWXXpXfiMPW4s/wg6BO1Mr FxH4wuUZerVSyQiVlUqfNh1aQL2MWNof1E5LacPQlQeFTY1Z1XU07Q/Kgwdc0NjdhMfo TafQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u25si12374501otg.170.2019.12.25.19.12.16; Wed, 25 Dec 2019 19:12:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727002AbfLZDKg (ORCPT + 99 others); Wed, 25 Dec 2019 22:10:36 -0500 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:47498 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726885AbfLZDKf (ORCPT ); Wed, 25 Dec 2019 22:10:35 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01f04446;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0TlwmUT6_1577329818; Received: from localhost(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TlwmUT6_1577329818) by smtp.aliyun-inc.com(127.0.0.1); Thu, 26 Dec 2019 11:10:33 +0800 From: Wen Yang To: Jens Axboe Cc: Joseph Qi , xlpang@linux.alibaba.com, Wen Yang , Mikulas Patocka , Mike Snitzer , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] block: make the io_ticks counter more accurate Date: Thu, 26 Dec 2019 11:10:14 +0800 Message-Id: <20191226031014.58970-1-wenyang@linux.alibaba.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of the jiffies, we should update the io_ticks counter with the passed in parameter 'now'. Signed-off-by: Wen Yang Reviewed-by: Joseph Qi Cc: Jens Axboe Cc: Mikulas Patocka Cc: Mike Snitzer Cc: linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- v2->v1: Use the same clock source for io_ticks and other statistics in the diskstats block/blk-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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