Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2821364ybl; Thu, 19 Dec 2019 22:17:51 -0800 (PST) X-Google-Smtp-Source: APXvYqzwNgOxZdA/nfICKNWvX9BZoVTv4aMQhBecKgjJSWH/EWpx33FtvJxCsYqfl/sxzOk7/8gz X-Received: by 2002:a05:6830:159a:: with SMTP id i26mr13439049otr.3.1576822671716; Thu, 19 Dec 2019 22:17:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576822671; cv=none; d=google.com; s=arc-20160816; b=bFfsZ/5zieKU2qnRfNrLSK7lUoSm3DEFY2+z+LeOBUMniIT9rW9DIa3NzKIw4BIR0c yW9Atq7zBed7on0PKu6XqPHXqS0bRI/ngS6gL2cJR542Y7f5pQNxFYiDaKgRmbHmgHK7 bRJeVES4zlh54Cc9lXaNftOZt2Wp6KePYAdED4UEoPvY5mBJrgz5+zgJo2V8N/03frF4 1qosMnkBuKlUNnkw/680N5j4O8i7ph7ps+BzUXe2kyUBVgJFlEYL7V0YFrYkLKRzuTEu fCXt67lp/rMd9SECKHxVvKPlg/pXrcwhuxz+7KnjK0Uvj5ahq7uRmFX31acbNU+t9Zvt CJng== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Z+JN4Urkmx1Jpk+hYAoydYsUtydmwbOGr+H5pAeel5g=; b=VOs6q7I98Yaikau5Mff247DW2qiRYKcQAQXXo3hZlDfqHLXTkwDVt9UXRUDATnk18R aOU3anF2JIlvtr1fePI55VOzIcyR9VzO+ebHZmIwf4nza+hOYoX3NhuZy7WKiC1a0kG8 Bl/mK3Kt9G0AR12sMYx4aOVJo6nFKtzDH+olrjIeII8e8X4s7gialCupzRfVQz64TwbF AmLoZX6brpPWndgH2YClk48DcQ49CC/A23KSSUePzw1qu8lNArzGnyKpkOczwPxKIDQZ potxjSnYmxIFc/7JqdtukgEQ6SUex/bo2U0bQYWQZa3IO3MIpwZ5d3GDu/RwUUrkodpW QUOQ== 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 i185si4485918oia.187.2019.12.19.22.17.39; Thu, 19 Dec 2019 22:17:51 -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 S1726327AbfLTGRA (ORCPT + 99 others); Fri, 20 Dec 2019 01:17:00 -0500 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:20213 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725853AbfLTGRA (ORCPT ); Fri, 20 Dec 2019 01:17:00 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R761e4;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=7;SR=0;TI=SMTPD_---0TlPVA1v_1576822598; Received: from IT-C02W23QPG8WN.local(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TlPVA1v_1576822598) by smtp.aliyun-inc.com(127.0.0.1); Fri, 20 Dec 2019 14:16:38 +0800 Subject: Re: [PATCH] block: make the io_ticks counter more accurate To: Jens Axboe Cc: Joseph Qi , xlpang@linux.alibaba.com, Mikulas Patocka , Mike Snitzer , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191217142828.79295-1-wenyang@linux.alibaba.com> <658ba1d9-45b3-db85-250d-7a1a9328e9ff@kernel.dk> From: Wen Yang Message-ID: <9e2de812-4ca7-3560-08ea-a346944c05d6@linux.alibaba.com> Date: Fri, 20 Dec 2019 14:16:38 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <658ba1d9-45b3-db85-250d-7a1a9328e9ff@kernel.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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