From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71D62C63705 for ; Wed, 7 Dec 2022 17:22:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670433742; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=FmMuoSNuM2bsOMYjF7IPYQN9kOfxyQ/IZlkVulEx1E8=; b=UgdSJHcYF2zR4BIfr7oxhDxesP+5l0nzQCMoyz6d2c5mTfKrFUvWJ+bbdkQLqrKVJcdlVu uI0E6RUgHYDCx1UPzzvYIyctimZF6Rd7o0JAOBEDjDK+kxIaxpUmxKF9rHGe4MWjLmbmKA 2k+7RlCYKJnZU8FvvgfJ42YMjdbxXKQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-hO54pdjdPMmQbnGbJ0UReg-1; Wed, 07 Dec 2022 12:22:18 -0500 X-MC-Unique: hO54pdjdPMmQbnGbJ0UReg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F10512999B35; Wed, 7 Dec 2022 17:22:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FBA839D7C; Wed, 7 Dec 2022 17:22:16 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B0EDB19465B9; Wed, 7 Dec 2022 17:22:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0A7D919465B1 for ; Wed, 7 Dec 2022 17:22:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BCA9F1415102; Wed, 7 Dec 2022 17:22:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B52481415100 for ; Wed, 7 Dec 2022 17:22:14 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 99FD486C14E for ; Wed, 7 Dec 2022 17:22:14 +0000 (UTC) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-629-S4ExOQj3Mv2oFat-8HtxeQ-2; Wed, 07 Dec 2022 12:22:13 -0500 X-MC-Unique: S4ExOQj3Mv2oFat-8HtxeQ-2 Received: by mail-io1-f52.google.com with SMTP id q190so7077384iod.10 for ; Wed, 07 Dec 2022 09:22:12 -0800 (PST) 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=X5VbyxiYTAlsV+cn05RmP1Ksuz6LkoZIWsoUzf32kaAG/oJm+O0tS+T9BhAKX64Vbi A6K9e/aqHfyGFTxAcEc3c/8ARzVG/f14gDFzIJHVgA2ugSRCNlyjcFCvbuRIk7A7YXLT dTYzckXSCzFVCzbeVkbwXk4ON7F2PUcRCLB9wSIjQhr3+XMbJOUiO3cDiD+2oXmHptBR /7S/s1Lxfq6IlxSz7Vpce7QezmiwcVEpOwTj7k9yfxCzPDiHjJImw4gGckGfbkjTxypq e3/EyMAtq0tK6wDOSGeoQYxYGU28o2xgR2vwma2O2Et2Gxm+w2ss1NEf95nGG8Y7FUD6 BqQw== X-Gm-Message-State: ANoB5plrswtoNYnV634V1Dg3MmqVmjPeVe/pIkpRvgK26iyUEZShCGDk 1/HyRYLh8ooMC6Vw1Xr/k4kRjw== X-Google-Smtp-Source: AA0mqf7/gBf7/XEEClF7Gq7hMc0QmhQHunFYc2f4SCWfcKxA9tFoQkk2RXV+JEDjVFWOG2u7WxQZig== 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 To: Yu Kuai , Ming Lei References: <20221206181536.13333-1-gulam.mohamed@oracle.com> <936a498b-19fe-36d5-ff32-817f153e57e3@huaweicloud.com> From: Jens Axboe In-Reply-To: X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Subject: Re: [dm-devel] [RFC] block: Change the granularity of io ticks from ms to ns X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, song@kernel.org, dm-devel@redhat.com, ira.weiny@intel.com, agk@redhat.com, drbd-dev@lists.linbit.com, dave.jiang@intel.com, christoph.boehmwalder@linbit.com, vishal.l.verma@intel.com, konrad.wilk@oracle.com, "yukuai \(C\)" , kent.overstreet@gmail.com, ngupta@vflare.org, kch@nvidia.com, senozhatsky@chromium.org, Gulam Mohamed , snitzer@kernel.org, colyli@suse.de, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dan.j.williams@intel.com, linux-raid@vger.kernel.org, martin.petersen@oracle.com, philipp.reisner@linbit.com, junxiao.bi@oracle.com, minchan@kernel.org, lars.ellenberg@linbit.com Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 T24gMTIvNy8yMiA2OjA54oCvQU0sIFl1I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HN0 YWNrLAp0aGVuIHRoYXQncyBhIHRlc3RhbWVudCB0byB0aGF0LgoKU28gdGhhdCdzIGEgdmVyeSBi YWQgYXNzdW1wdGlvbiwgYW5kIGRlZmluaXRlbHkgd3JvbmcuCgotLSAKSmVucyBBeGJvZQoKCi0t CmRtLWRldmVsIG1haWxpbmcgbGlzdApkbS1kZXZlbEByZWRoYXQuY29tCmh0dHBzOi8vbGlzdG1h bi5yZWRoYXQuY29tL21haWxtYW4vbGlzdGluZm8vZG0tZGV2ZWwK From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33976C352A1 for ; Wed, 7 Dec 2022 17:22:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbiLGRWU (ORCPT ); Wed, 7 Dec 2022 12:22:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbiLGRWN (ORCPT ); Wed, 7 Dec 2022 12:22:13 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27BF11DDC9 for ; Wed, 7 Dec 2022 09:22:13 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id n63so7744626iod.7 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=qTW8RFJffeqxH3m+CJExUZx3MdKNqooiepFlSxZfBU486otIAnPUKdpyERRFoy/10Q 7fIKv5nqev30OHMz7TyKRraN1WXBj5loA1OhgHbCAkZcDFxewX1LBg40I5vlaFFQSpFU SUFwFfBodBCPZNIQqZN1pvhXbD4w8cjnzCuBDDZHRz08+6BymJG16E2BDLIvx1HA16hW 1uMNF6r1pHl7KFy72CifamQhVgmcDtbO5CPW/o0+eIQE6UD+zcvUOkxAqcVJgs7xO+WB uJhrVpsJig8C/gH2+LwBm9D61vT60SX1ah1bLdcUuJlfwH45ke2y9Z4a/cYrXqKRG1a1 KzOQ== X-Gm-Message-State: ANoB5pkDPrXJiGC+36JxfUfySedAhRJK8VLhjMh1jdGk2L1IF6Y+lJqT 00EXmW6e2+oAbf4QPgtVYzp3Qw== X-Google-Smtp-Source: AA0mqf7/gBf7/XEEClF7Gq7hMc0QmhQHunFYc2f4SCWfcKxA9tFoQkk2RXV+JEDjVFWOG2u7WxQZig== 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 Precedence: bulk List-ID: X-Mailing-List: linux-bcache@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by mail19.linbit.com (LINBIT Mail Daemon) with ESMTP id B662642177D for ; Wed, 7 Dec 2022 18:22:13 +0100 (CET) Received: by mail-io1-f43.google.com with SMTP id o189so6519458iof.0 for ; Wed, 07 Dec 2022 09:22:13 -0800 (PST) Message-ID: Date: Wed, 7 Dec 2022 10:22:09 -0700 MIME-Version: 1.0 Content-Language: en-US To: Yu Kuai , Ming Lei 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 Cc: nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, song@kernel.org, dm-devel@redhat.com, ira.weiny@intel.com, agk@redhat.com, drbd-dev@lists.linbit.com, dave.jiang@intel.com, vishal.l.verma@intel.com, konrad.wilk@oracle.com, "yukuai \(C\)" , kent.overstreet@gmail.com, ngupta@vflare.org, kch@nvidia.com, senozhatsky@chromium.org, Gulam Mohamed , snitzer@kernel.org, colyli@suse.de, linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, dan.j.williams@intel.com, linux-raid@vger.kernel.org, martin.petersen@oracle.com, philipp.reisner@linbit.com, junxiao.bi@oracle.com, minchan@kernel.org, lars.ellenberg@linbit.com Subject: Re: [Drbd-dev] [RFC] block: Change the granularity of io ticks from ms to ns List-Id: "*Coordination* of development, patches, contributions -- *Questions* \(even to developers\) go to drbd-user, please." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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