Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1607716pxu; Sun, 6 Dec 2020 01:18:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwYEgcSlcI7YVSlaWK8EjXz90+88l849rpbzV+p7aLH/CF90Lv47xL0roaDgk969AvruEAr X-Received: by 2002:a17:906:8693:: with SMTP id g19mr15159635ejx.111.1607246326624; Sun, 06 Dec 2020 01:18:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607246326; cv=none; d=google.com; s=arc-20160816; b=NXQOHbeyRx72O7gqzgNu/MTyQuvqFlWCeuES2fo1GUmgJknWs7agLOUFgZMaLRlwl9 CaljrbhaT/TsxDkcX7gCgCIKR0NYw3UBcAOrmzdiDtAHbfJqfPq+vtgGujZXQN2AAJkC 35pRR6nf+EdwZV2JAZmjxAXKL58G5LObcmV/THXTO7C6OrIf3FakJ0SF07OSj6ZLZJBc lNPyW8pHTU12ucQohbnirq9Dy3O8FuAVTKC3lG4MTiHuKTD4Ab+Hz5wvxTvKXUlBXW+D sM0hcfNHjlH2NnWCTWlG2A3j0bw2owelhUf3LvAVFOQau81Y7tLk59sKeE6xyd2lM2Y/ xz/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=uWk/ZRFS7dLbnP3Icptxi63b/iAaHBAe2xX/prVRC2A=; b=pPCIDcYCGyNHIZwmLte0Io/kJuRv/HFcwFvlWnhMVIEtaTpW+erjalT2Ixq9uigGGm DorrvNYSIhi49BWnaI2CFEUaWOBlfqW5zgkPV9hfFRG4Blg8pBN7OtQEX/AFVVuqb4oQ Z4uV/QSOO6ydJDEFWZo5npdLYz0U6qCYf3Lv9Cuv4nsOsskGCrW5dukb2P1hhsGR2fHo fIcEaJzn3G6coOTX7tmCsXZ9YFBb6LFH92youY3Hcx22Fji/Zoh9buCulObkjQRu6a8p EefnLwhpPpZw+wHmPJ6t3NXWD/MGEHZjJLxe/eivbrTJZdCXcDpCe8a8Gq2OW1nIUkLM VTIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mxvysfcb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si5951649edh.40.2020.12.06.01.18.23; Sun, 06 Dec 2020 01:18:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Mxvysfcb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726023AbgLFJQ2 (ORCPT + 99 others); Sun, 6 Dec 2020 04:16:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725767AbgLFJQ2 (ORCPT ); Sun, 6 Dec 2020 04:16:28 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B71E3C0613D0; Sun, 6 Dec 2020 01:15:47 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id x6so5698121wro.11; Sun, 06 Dec 2020 01:15:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=uWk/ZRFS7dLbnP3Icptxi63b/iAaHBAe2xX/prVRC2A=; b=MxvysfcbhTOE4RIcvS3qS2OJk1Fgl/BhBQaxSm7UWjZz3ysBvXMOSAiV1fQKEaOVuL aDNAJxI9uHerhcvjWtdkd3bOyJztzaW11B4siaY5kYTzxmSTsq9ZCLIcmLfpIr5av2N5 DmdbbFUu7FvYRj2sDIBnK4sEt+YQStNNdhASmHA+02dAk6dAVcTFtloScu+FwT2p3IIA EPh1XpBCRLlE0Mo8bzUIrJNwdvtqRMFiaFrurkZErtgbmRrapN4jn+BJ8p8+3dhqR86J 1b6FFSPAVoULwr1vlWKIyxxo0KUXlSbcTkHLRQV894VdJ3LSnWTt6nEUBv9rrnJMIfZs 5DVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=uWk/ZRFS7dLbnP3Icptxi63b/iAaHBAe2xX/prVRC2A=; b=gTtydRUcXQwDHSSzdIc/wVynu5/UD+Jt6Tn7SYNQVeqQPLQohRwQ2h8ObIeMH8WMvM iRlYEjBRiDqoTEgjoo6xl6/ewDn4shJFjquBmFUolIjRc8ZeNiiV4aGP10lHq/9SRXr7 X7CCkwtz0tCBLMFaNFrqZzrgl1cMy5+HsJ7nnZOPbV3jqnyoZALpMlnh7KMFBKkR4B/b TPdNe0wRSC7ODf3avHUVjnebCNg668AesnEVo+Ln0YcQ3nWLVXfGZQZQ0wBNZnIag/84 YKAQCwVWm8jqQPVHN56I67DSJUovdcb2Nig305XsGDNySnCFu/Bfv2fOBy6eKdKQwRAD KeFg== X-Gm-Message-State: AOAM531HQ7ORlszDu2/azzjwZPYnN9M9zjxQr6rSsLidMJWwclujHeIZ jNAkKuTDlkJP10CDG4e6rBv5hGEXLwFdsEkU2fU= X-Received: by 2002:adf:f602:: with SMTP id t2mr14246671wrp.40.1607246146193; Sun, 06 Dec 2020 01:15:46 -0800 (PST) MIME-Version: 1.0 References: <20201206064624.GA5871@ubuntu> <4e339fb4-adae-4c28-a40b-986b5e73fd0d@suse.com> In-Reply-To: <4e339fb4-adae-4c28-a40b-986b5e73fd0d@suse.com> From: Yun Levi Date: Sun, 6 Dec 2020 18:15:32 +0900 Message-ID: Subject: Re: [PATCH v2 1/8] lib/find_bit.c: Add find_last_zero_bit To: Nikolay Borisov Cc: Greg KH , Andrew Morton , Yury Norov , Andy Shevchenko , richard.weiyang@linux.alibaba.com, christian.brauner@ubuntu.com, Arnd Bergmann , Josh Poimboeuf , rdunlap@infradead.org, masahiroy@kernel.org, peterz@infradead.org, peter.enderborg@sony.com, krzk@kernel.org, Brendan Higgins , Kees Cook , broonie@kernel.org, matti.vaittinen@fi.rohmeurope.com, mhiramat@kernel.org, jpa@git.mail.kapsi.fi, nivedita@alum.mit.edu, Alexander Potapenko , orson.zhai@unisoc.com, Takahiro Akashi , clm@fb.com, Josef Bacik , dsterba@suse.com, dushistov@mail.ru, Linux Kernel Mailing List , linux-arch@vger.kernel.org, linux-btrfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > btrfs' free space cache v1 is going to be removed some time in the > future so introducing kernel-wide change just for its own sake is a bit > premature. Sorry, I don't know about this fact Thanks.. > Also do you have measurements showing it indeed improves > performances? I'm not test btrfs' free space cache directly, But I used find_bit_benchmar= k.c. here is the result of find_bit_benchmark. Start testing find_bit() with random-filled bitmap [ +0.001874] find_next_bit: 816326 ns, 163323 iterati= ons [ +0.000822] find_next_zero_bit: 808977 ns, 164357 iterations [ +0.000571] find_last_bit: 561444 ns, 163323 iterat= ions [ +0.000619] find_last_zero_bit: 609533 ns, 164357 iterations [ +0.002043] find_first_bit: 2011390 ns, 16204 iterations [ +0.000003] find_next_and_bit: 59 ns, 0 iterations [ +0.000001] Start testing find_bit() with sparse bitmap [ +0.000068] find_next_bit: 34573 ns, 653 iteratio= ns [ +0.001691] find_next_zero_bit: 1663556 ns, 327027 iterations [ +0.000010] find_last_bit: 7864 ns, 653 iteratio= ns [ +0.001235] find_last_zero_bit: 1216449 ns, 327027 iterations [ +0.000664] find_first_bit: 653148 ns, 653 iterations [ +0.000002] find_next_and_bit: 44 ns, 0 iterations as this result, the find_last_zero_bit is a little fast, and logically, because find_each_clear_bit is iterate till the specified index (i) times, But find_last_zero_bit in that case call one time (find_each_clear_bit call i times but find_last_zero_bit call only one time= ) So, i think it has a slight improvement. Thanks. Levi. On Sun, Dec 6, 2020 at 6:01 PM Nikolay Borisov wrote: > > > > On 6.12.20 =D0=B3. 10:56 =D1=87., Yun Levi wrote: > >> This, and the change above this, are not related to this patch so you > >> might not want to include them. > > > >> Also, why is this patch series even needed? I don't see a justificati= on > >> for it anywhere, only "what" this patch is, not "why". > > > > I think the find_last_zero_bit will help to improve in > > 7th patch's change and It can be used in the future. > > But if my thinking is bad.. Please let me know.. > > > > Thanks. > > Levi. > > > > btrfs' free space cache v1 is going to be removed some time in the > future so introducing kernel-wide change just for its own sake is a bit > premature. Also do you have measurements showing it indeed improves > performances?