Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1218971rwb; Wed, 7 Dec 2022 10:01:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4C6NIY+pgZenncw9OPJ6b54VvdbAbekCOtmCQvKcIaach9aTqbMnAUgQd7V7ZYx1zPX+Sr X-Received: by 2002:a05:6402:68f:b0:46c:53ea:4a64 with SMTP id f15-20020a056402068f00b0046c53ea4a64mr18112992edy.413.1670436071958; Wed, 07 Dec 2022 10:01:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670436071; cv=none; d=google.com; s=arc-20160816; b=duM/wqGvYelqrM8znoEl5whvsPREye7u4WrzR6vks8xGgVlUBESMk7OGqi39ETxTng bMjad3S7EUw2v6EbVTYKMiFN5gOs5zV6f3TpoAIm7uLe6ujYBtVmNA/6hNA9aHoBpRyT ViavLm8k7vONE4bxmWZI4wsurUuRbSjicL8bJ6cCOga56ShdxKmK8kqzjuUAOAeVBfFQ wcFUBFY3oMlQBOIDy6GWEgIc3h44Z0y5FBnstH7aFoUyVTetIA8HULRfthaNrw14EuKE c81TDiAcxHvdG5InxOUG8KuxHEdwdX1x862ORPlWIb16+8g1tQccMdpnjv09XHTz6bwo DgiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=EpTDLOhW0V3+1aR8vlaV9Hai3rR7JGPJvFehDEM1z0k=; b=BsT2zBxGiwrl0GTYxyR81HNO33YtgDhDkR2/zZ40/JzR8+11PnU/nhUAlqngcg/ALv p7gbW0T3SJHoU5ts4IX3WT14rc3AA7ST6izK8ryDtL8bVd11piw4wrEF6TkiL1Z9i5Kd 8V0TK5YKOmlIWdLdWHWDI217Ud3u3LYZKk2RMRl3ddspg2v/vCy7L4q7/NreKXAnlLAm 9WPnI1oHml61YcmQs4CYSVqwCbkAGYKMLqshQA5YEpfFhCiFiyKBh7wDb8UHfpp71uhU bulkX5odOV/ehKrkokSiHDVOJ9jKVzHh2Bio8brYnQvmqApGVistfVgysRdYtOCdgMPM F6Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=WuLBfeGF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a17090640d400b007c1027d92a1si5081563ejk.292.2022.12.07.10.00.52; Wed, 07 Dec 2022 10:01:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20210112.gappssmtp.com header.s=20210112 header.b=WuLBfeGF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229651AbiLGRWX (ORCPT + 75 others); Wed, 7 Dec 2022 12:22:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbiLGRWO (ORCPT ); Wed, 7 Dec 2022 12:22:14 -0500 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CA805288D for ; Wed, 7 Dec 2022 09:22:13 -0800 (PST) Received: by mail-io1-xd33.google.com with SMTP id d123so6737879iof.6 for ; Wed, 07 Dec 2022 09:22:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=EpTDLOhW0V3+1aR8vlaV9Hai3rR7JGPJvFehDEM1z0k=; b=WuLBfeGFwu+0r21caxzCY0+TP72iv0Vmz6j4f2nARaTkZ6MmLakC7hya4ycSRvqMDI SuzvbugdfQlsXrJGaT4MBJtrovZDXTkclAPuy4ARX/NXLtySpWY43xZIWrBasgcQugq8 vQhfZ35UxQngr2AbHjR8VvqDdM2S7bawB1nbVd8IAIAtAJ6QIM0groms0cVRZmf/5hJ5 gYRuWN4pmn37QJI13DuMnWpuKPm3dQxH/KlZ9pWGQ70mwlSqfH7NoBL0xtcoQk0ex4xM qbmg7ziYNHJJjBjTSvOZVicehGzE9TQ8n7q/GwtauEdZJAs9Wa7FXxqQQfBLwFZUidsz /Q3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EpTDLOhW0V3+1aR8vlaV9Hai3rR7JGPJvFehDEM1z0k=; b=4MElZbq5TzKiU/MxMV8OssUaURm6AWFfIUCSWki2y70fN+kPsEcq9SvM4o0LILm0Zo nCmFqExQHm0lpytwZswnPI0zKT9C3TeNevuxdTsfEapvvidOuO0T8JW1dcSsgOuAeQGq JbpX3Xwo4G0MBhjz5aFHXPs/ZxkaDSPKWbxUlQhz1xop+dFrkEK6VFkztdhL+Jx6a6uU QA/h/3fGoOWonf5zpGzyMOgIsxKx2YHZf8/gq9QdjC2UMveqsnWFLDWVhvJnwY0oQdEe KmxI7vRSPnKapWTdfE7q5uTLXQ2K0M34RfjzY35wPFiFEnwIOrNhIUT2mai3WrTIUFXO wBYA== X-Gm-Message-State: ANoB5pmPuNtLyZT7z98tieHbEqw38+/T1cF511iyDBqd+tLKm8ZZ0yIi ZPwRTWs9gViAv/yfCW/F/hh4rA== X-Received: by 2002:a05:6602:4296:b0:6e0:1464:a7d7 with SMTP id cd22-20020a056602429600b006e01464a7d7mr5843517iob.60.1670433732410; Wed, 07 Dec 2022 09:22:12 -0800 (PST) Received: from [192.168.1.94] ([207.135.234.126]) by smtp.gmail.com with ESMTPSA id q34-20020a056638346200b0038a44dbbd8fsm3597816jav.123.2022.12.07.09.22.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Dec 2022 09:22:11 -0800 (PST) Message-ID: Date: Wed, 7 Dec 2022 10:22:09 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [RFC] block: Change the granularity of io ticks from ms to ns Content-Language: en-US To: Yu Kuai , Ming Lei Cc: Gulam Mohamed , linux-block@vger.kernel.org, philipp.reisner@linbit.com, lars.ellenberg@linbit.com, christoph.boehmwalder@linbit.com, minchan@kernel.org, ngupta@vflare.org, senozhatsky@chromium.org, colyli@suse.de, kent.overstreet@gmail.com, agk@redhat.com, snitzer@kernel.org, dm-devel@redhat.com, song@kernel.org, dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, ira.weiny@intel.com, junxiao.bi@oracle.com, martin.petersen@oracle.com, kch@nvidia.com, drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org, linux-bcache@vger.kernel.org, linux-raid@vger.kernel.org, nvdimm@lists.linux.dev, konrad.wilk@oracle.com, "yukuai (C)" References: <20221206181536.13333-1-gulam.mohamed@oracle.com> <936a498b-19fe-36d5-ff32-817f153e57e3@huaweicloud.com> From: Jens Axboe In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/7/22 6:09 AM, Yu Kuai wrote: > Hi, > > 在 2022/12/07 11:15, Ming Lei 写道: >> On Wed, Dec 07, 2022 at 10:19:08AM +0800, Yu Kuai wrote: >>> Hi, >>> >>> 在 2022/12/07 2:15, Gulam Mohamed 写道: >>>> Use ktime to change the granularity of IO accounting in block layer from >>>> milli-seconds to nano-seconds to get the proper latency values for the >>>> devices whose latency is in micro-seconds. After changing the granularity >>>> to nano-seconds the iostat command, which was showing incorrect values for >>>> %util, is now showing correct values. >>> >>> This patch didn't correct the counting of io_ticks, just make the >>> error accounting from jiffies(ms) to ns. The problem that util can be >>> smaller or larger still exist. >> >> Agree. >> >>> >>> However, I think this change make sense consider that error margin is >>> much smaller, and performance overhead should be minimum. >>> >>> Hi, Ming, how do you think? >> >> I remembered that ktime_get() has non-negligible overhead, is there any >> test data(iops/cpu utilization) when running fio or t/io_uring on >> null_blk with this patch? > > Yes, testing with null_blk is necessary, we don't want any performance > regression. null_blk is fine as a substitute, but I'd much rather run this on my test bench with actual IO and devices. > BTW, I thought it's fine because it's already used for tracking io > latency. Reading a nsec timestamp is a LOT more expensive than reading jiffies, which is essentially free. If you look at the amount of work that's gone into minimizing ktime_get() for the fast path in the IO stack, then that's a testament to that. So that's a very bad assumption, and definitely wrong. -- Jens Axboe