Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp9983729ybl; Thu, 26 Dec 2019 08:43:17 -0800 (PST) X-Google-Smtp-Source: APXvYqzjklKMYv7EkzR5ivHPflKC9v3wDK9zpoN56eJlY+iwG7uy/YZfrgL7TXMrg4hcNGiyJ5U0 X-Received: by 2002:a05:6830:1bf8:: with SMTP id k24mr36494260otb.215.1577378597661; Thu, 26 Dec 2019 08:43:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577378597; cv=none; d=google.com; s=arc-20160816; b=QrkIN10zVRd8hGlMPe7WaMvEAZZCMwzdtOvevCQcAdtCWuCa9CNzmusIZYY8dyCv/G 92wQMI9aEzbqTljSHapHPBrxcSK2FspfQnEJJRfZKHAe3ZdwG3zRBPRFzjwgLZqOQUeO GAKtwGOcZgxueKv3HJKdw2X8TbD/qfOdUt+8w8AEocbgUlwlDfKYbrSqSgQ8vgloFIsc CTTszupt3HBLLtA+pQSnZsG2SfurTRgRHiDsQEu8jo+El5kaTzUHfoKhLHp4mcppJ+uo qw6H0ze8C8fOceu53L9f35MpKEDKxoAOTgMQ6z5clPNgQCDI5+Z6mlxVr9HJabGHU6oJ cYYQ== 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=eeUNhTC5vb2A7TnuszTz5yK89eDSjfbfDTV3O+S7vFg=; b=hFVIoYZ92kVqHWQrq66S0rZhHE5sbdOnKak4juaoMhIoFXbDr2rYzGnLCAUn+jOTYx fgmd5vs4R8vV7p7Tf5OCqLRzRqPM2w5Bn0D+f1FrcMIqR2zO7sZG46ySHh1+oJqrqFQK tPSG63e//hybuWuqZRdwWuaXa3KEF2/1zDyXkUHQHB797E39HjpHozUSgwUuxnGhMNpi lEuHlqziBzYIPHgbKBPKOKS5gIaJBlJI3xrR1HWS7GHJrg2g8c60M4IkYGnzJepBUnf+ qYcz3ar8TL8JJNEdyP0iHD46sowqPiBM9shDVrkBP+nWYyeRuVHGCfnL9X22QDXHQak8 b44w== 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 l18si15845001oth.236.2019.12.26.08.43.05; Thu, 26 Dec 2019 08:43:17 -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 S1726920AbfLZQmX (ORCPT + 99 others); Thu, 26 Dec 2019 11:42:23 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:46757 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726597AbfLZQmX (ORCPT ); Thu, 26 Dec 2019 11:42:23 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R261e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01422;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tm-.zlD_1577378536; Received: from IT-C02W23QPG8WN.local(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0Tm-.zlD_1577378536) by smtp.aliyun-inc.com(127.0.0.1); Fri, 27 Dec 2019 00:42:17 +0800 Subject: Re: [PATCH v2] 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: <20191226031014.58970-1-wenyang@linux.alibaba.com> <41175786-8a02-62e0-fc79-955ec0e74aeb@kernel.dk> From: Wen Yang Message-ID: <533328c7-4158-d9fd-d8db-0d02eb9c5108@linux.alibaba.com> Date: Fri, 27 Dec 2019 00:42:16 +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: <41175786-8a02-62e0-fc79-955ec0e74aeb@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/26 11:39 上午, Jens Axboe wrote: > On 12/25/19 8:10 PM, Wen Yang wrote: >> Instead of the jiffies, we should update the io_ticks counter >> with the passed in parameter 'now'. > > I'm still missing some justification for this. What exactly is this > patch trying to solve or improve? Your commit message says "we should", > but why? > Hi Jens, Thank you for your comments. We observed in the document that: io_ticks ======== This value counts the number of milliseconds during which the device has had I/O requests queued. And the iostat command uses io_ticks count to calculate %util: https://github.com/sysstat/sysstat/blob/master/rd_stats.c#L372 eg: Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util So we need to unify the time windows of these statistics(io_ticks, rd_tick, time_in_queue, etc). However, the current code uses jiffies to count io_ticks. Jiffies is different from the passed in parameter 'now', so these statistics will be inconsistent: void blk_account_io_done(struct request *req, u64 now) { … update_io_ticks(part, jiffies); 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)); … } In addition, we also found another issue: the update_io_tick() function only adds one to io_ticks at a time, which will result in the calculated %util lower than the real one. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/block/bio.c#n1713 We will try our best to improve it. please kindly help with some suggestions. Thanks. -- Best Regards, Wen