Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1592589pxu; Sun, 6 Dec 2020 00:42:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVwI6ztrzTD8EPlvCRBf0v1mP4tCeQqY4ZJBVR0UJIyU9X9DOYbY5XWEX4jPsEF7ka0o0P X-Received: by 2002:a17:906:3381:: with SMTP id v1mr11082792eja.280.1607244152558; Sun, 06 Dec 2020 00:42:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607244152; cv=none; d=google.com; s=arc-20160816; b=z304ntL5Yb+IzG8drZE0vOvVxgZOSwKHyZPYzQg8J2oWT9oTElbnZ+eDdQCI9gYhyy 6ljYJzHuIDPs/rEM9zApkV7GkOV8ZTxEAh/rWS19l8rqBPItjkyg0wnMRj+RqUsPkdtN 2AsliapMtBu91mWiYshS2325eJAcfMNATWeIuwUMSWloEYx0Z1hjPYgnkOLzZbMI7zX2 YbzqEA2RqHv3dOgyxGSDt+hvYGRXQCjHNfRoZ30A2Iq5kxUf9POMeZRFTsjNMlvh3fVj OCXN8aq7pVgkg7cHxUy88CUonBimZNCS9I6ag5q/wQk2hUhJDT55BqDfq3xPoB7BSw4+ xO9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GPQpDYkjbkwCoiD1+juG9zqIYLBLtaHF+LBjNA/5Kdw=; b=cI25ZqdI5iY5Ps+z5WBaR4px9KC14REvTdzVSTUo/zU3cIRszdNLcOhG1CwfnoD6Km 22BOqaS9/HYao/QglxBCGHxlq6xmfx8W3nsBdQnTiVYOe9yiOdtRTYR1aZoQdB/HSjsB VBXPu5fH8J6vfvYs7L5ZfKGcvxYJp5QShpRqeFgEw2qkjHsm+vlUhM37W7kvTKisPFXO GICeOfdbBAJYyeMVm/bP2KsybhzvLcrbAUkSdr6gleypS9C8U3XRXLbiEz2sMjxOMF5C Cb1pSSjuG9cvC8MpG35KSxym0KXbLk7WIrrmp6A7wPKWmD2aIL1C/tb7pPXhmTZOf085 LkvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ri2vWoYT; 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 b20si6128162edv.300.2020.12.06.00.42.08; Sun, 06 Dec 2020 00:42:32 -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=Ri2vWoYT; 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 S1726122AbgLFIkS (ORCPT + 99 others); Sun, 6 Dec 2020 03:40:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725772AbgLFIkR (ORCPT ); Sun, 6 Dec 2020 03:40:17 -0500 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78040C0613D0; Sun, 6 Dec 2020 00:39:31 -0800 (PST) Received: by mail-wr1-x441.google.com with SMTP id i2so9583734wrs.4; Sun, 06 Dec 2020 00:39:31 -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; bh=GPQpDYkjbkwCoiD1+juG9zqIYLBLtaHF+LBjNA/5Kdw=; b=Ri2vWoYTJ6G4Stx/W9/EYkJ3p9wOMxhUIFWSDuloMlm/SWfoUlIXMT1ryZF7IA2BC0 NRpm/uvuta153AlhOPDBk5civ/b4qENFWDA+LxuXIrkK2abp18f2TCu8MOyZqjz7zD78 p0Nx08WryRYzZmN4hHUBQBaRVB214Dt1G3MuZfZh1Ka79Fhu4x+Bd6yILRPeB3OKccVc cbJMZ8rv+c5yTpJnBFOIZ2jaOiu6NXHUZjryY3SwDAFvqbY63IzIKGwnhIEQeTYzajho 95m26ZgpUqeueYDQ4Dd9Qroy/rLlSDEtoN9cea5IEQA02lQT9tNtbWixzw7y4bdDo+/j xtlQ== 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; bh=GPQpDYkjbkwCoiD1+juG9zqIYLBLtaHF+LBjNA/5Kdw=; b=JOfSWb3nMNQWkZ5FcXEwRuAhJXiFxJt0GymsT52icJ2XdYkmEpiMZNXiWz5KNgIVwT tYaE+PztlbRo7XfrsToKGBi0/C/bGVTIeunnEJcZnidJOFe92TNeaRrQOqQGtJtuU1Ec Xk6eb/8MgznHxLLlbt3HZ+3JpcdJi3XFYDmOmvhdxYLdiayOskbbqZc7YgfhpeSlfT5E SNMsIYQxLGSyvvRbBXJR9b2lfXXFVeNDmUNS/ORUQ4CELVZd5yvaDdM+FCBTdWeGk8jq WMwEQ59ngk3esB/lVCL8vKpkuUfv7FUm/9BinzET6tFJtBYnT9f2bD+CxaMC6xvAntqS K4IQ== X-Gm-Message-State: AOAM531aulND07+S4ACESdxv3Xw683ne+WKPYjvA1L7zNZboOGrP4fDR 0x/QNF/PBALb5K1dX7zrcWCikOO5M+ffDilDTSE= X-Received: by 2002:adf:90f1:: with SMTP id i104mr10248596wri.348.1607243969831; Sun, 06 Dec 2020 00:39:29 -0800 (PST) MIME-Version: 1.0 References: <20201206064624.GA5871@ubuntu> In-Reply-To: From: Yun Levi Date: Sun, 6 Dec 2020 17:39:16 +0900 Message-ID: Subject: Re: [PATCH v2 1/8] lib/find_bit.c: Add find_last_zero_bit To: gregkh@linuxfoundation.org Cc: Andrew Morton , Yury Norov , Andy Shevchenko , richard.weiyang@linux.alibaba.com, christian.brauner@ubuntu.com, Arnd Bergmann , Josh Poimboeuf , changbin.du@intel.com, 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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 justification > for it anywhere, only "what" this patch is, not "why". A little part of codes are trying to find the last zero bit using for_each_clear_bit. For example in fs/btrfs/free-space-cache.c' s steal_from_bitmap_to_front function which I changed in the 8'th patch. I think it has some overhead to find the last clear bit (it start to find from 0 bit to specified index), so I try to add the find_last_zero_bit function to improve this. Maybe I have a lack explanation in the message. Sorry to make noise. Thanks. Levi. On Sun, Dec 6, 2020 at 5:31 PM Greg KH wrote: > > On Sun, Dec 06, 2020 at 03:46:24PM +0900, Levi Yun wrote: > > Inspired find_next_*_bit and find_last_bit, add find_last_zero_bit > > And add le support about find_last_bit and find_last_zero_bit. > > > > Signed-off-by: Levi Yun > > --- > > lib/find_bit.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-- > > 1 file changed, 62 insertions(+), 2 deletions(-) > > > > diff --git a/lib/find_bit.c b/lib/find_bit.c > > index 4a8751010d59..f9dda2bf7fa9 100644 > > --- a/lib/find_bit.c > > +++ b/lib/find_bit.c > > @@ -90,7 +90,7 @@ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, > > EXPORT_SYMBOL(find_next_zero_bit); > > #endif > > > > -#if !defined(find_next_and_bit) > > +#ifndef find_next_and_bit > > unsigned long find_next_and_bit(const unsigned long *addr1, > > const unsigned long *addr2, unsigned long size, > > unsigned long offset) > > @@ -141,7 +141,7 @@ unsigned long find_last_bit(const unsigned long *addr, unsigned long size) > > { > > if (size) { > > unsigned long val = BITMAP_LAST_WORD_MASK(size); > > - unsigned long idx = (size-1) / BITS_PER_LONG; > > + unsigned long idx = (size - 1) / BITS_PER_LONG; > > > > do { > > val &= addr[idx]; > > 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 justification > for it anywhere, only "what" this patch is, not "why". > > thanks > > greg k-h