Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp70650pxu; Wed, 2 Dec 2020 15:20:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxyTCaIrDBdYAZ2BFoI9abAzCcok+amH2xNbVhGd4XORXxjLB0wbk04BCr+sc4fGO7H/+M1 X-Received: by 2002:a05:6402:21a:: with SMTP id t26mr349256edv.173.1606951248950; Wed, 02 Dec 2020 15:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606951248; cv=none; d=google.com; s=arc-20160816; b=hTVApoIgUeJSPu3z7GGZJ4ao+77rFSzU1xfKRjzWBUHQ5kkCV0NmRVFHxWvKJTkaKg p1DaQaAU4kdxwbik2RjUv17eibbCvxHB2fNpC5e7OzOlulFmMRrrzbtK9mhmuiq7K/Ks UhlT/HZEkg+LhSaRDUOxzvJcXkzSK3BP6r+UTv4oZf2aOrQwcehMb8tG/EKcRr2qi7Sy sbep9yD9QxBnuGn/V/OMDrFbQbTTADAQJEiLhRFRb4JkfT2LjLvTzfmfJiue605Yi0U3 mhQx68rMjaE24tmumvqwtLWQ7Ks2PIUFEhSe3OHQO9fRPO95mWnjuwi2Gr+u26Rj2oq5 ev4A== 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=MB3FdpRELFWiz8q8bY0RBSJbKRTsMS1clEeRrf7bS9Q=; b=QmUmnx/LgddNUQ1j2sw4CptyXq4b2RwG7PBbo5Fgmf1evTf/ybtNaeN5rdvk1AgLJR N6xart7aY+BYJxHGwiy/SADNjtiIe+GWC0ipMmYqnB3jW5ddGgZtCFtaKVhozdaZItXW ZEdDua0JVVrXgayvhbalqenk27nOS8OIg+PkBPaa8I+a5UQiQFqSEYzAJbR3mt+4FWfz IWL+80gUHVnUNXS1Ra/c0DE8XVDsQvxEtb7pTgjT5ObcmG5p+AaTmsy18O9qYaTTZfXs ZoZgaW+6AjsMpgaOsFdoyqcVlNcmEMcO8TNXfkNgD2jo85UAFIWp1cte8JB+uAiL+SB4 gZZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iD5OSnKX; 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 o3si53726ejn.637.2020.12.02.15.20.25; Wed, 02 Dec 2020 15:20:48 -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=iD5OSnKX; 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 S1729127AbgLBXRK (ORCPT + 99 others); Wed, 2 Dec 2020 18:17:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729059AbgLBXRJ (ORCPT ); Wed, 2 Dec 2020 18:17:09 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B94DC0617A6; Wed, 2 Dec 2020 15:16:29 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id i2so5884947wrs.4; Wed, 02 Dec 2020 15:16:29 -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=MB3FdpRELFWiz8q8bY0RBSJbKRTsMS1clEeRrf7bS9Q=; b=iD5OSnKX1fSJz6wfL58VdGDRx67hBdluAh0i0fOjNb0+Z4R6Ew3N58SVawo735wgYC 5C8i0u/6/w+odTPFD7pOmhl8FX1jiUK9WuL4epY2n6DhOfs7h5PwIbLe+rJulz+9Fxqh aiUqniQiODlz5n1Xy3xt5O1qUifOLMlozAP6KpifQy4EGQwPoMdsw02pOEHKrTWZ8WR1 zXCiGXlZ/vLekLua4cNjQZt2oVfhRykjbnvYu/CPhFh5EgieOS/itUVYaZ9IXXNG7CJj LToGqi+62bgJBEj3mB2D0o6zVOGhTPrjX0P5l3v5vV21u9G41iZjN9i56jD+juRjVfUe eSYQ== 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=MB3FdpRELFWiz8q8bY0RBSJbKRTsMS1clEeRrf7bS9Q=; b=RnFZEtUYeI2Sz4/Jjg3MZ/lt1WjZ4XS5s4t0lyUA7bxtKxdDla9FJhSBgAnLaaETFC SpIzxEIctkVZFZ4EDLNvIkPA9k/mBpA/7L5342dzdZbsUAk9lvLf8KpdrD38ax9m6HFw Bb7KBGSDQbLysbqgLWee7TlqyGuQHOL+kq7EHtGWsFEeeItKom3f58qNEMykLiZ0NWJL Ngxbzvf5rp1STN0bRRlR+mrG5w7rD3sENRcwhXriW8YPN1G3/pc8iqdH65odFlz9mwnm 6jExApN0zWM/fHg+yBczg2odLEIjmzu1svWsHddX4tAfgC6AVkRIfi1+LAVyQjAEAu/l QsfA== X-Gm-Message-State: AOAM531KFbXDo/KlngKyG0OKsTLJF4JwF0bhCC5qgMC+0ljPCQGdIqke vj+pp3WLGWNdXgQ/UqPSqYjewlVfvioe2QULEIA= X-Received: by 2002:adf:f602:: with SMTP id t2mr475526wrp.40.1606950987817; Wed, 02 Dec 2020 15:16:27 -0800 (PST) MIME-Version: 1.0 References: <20201202094717.GX4077@smile.fi.intel.com> <20201202173701.GM4077@smile.fi.intel.com> <20201202185127.GO4077@smile.fi.intel.com> <20201202185631.GQ4077@smile.fi.intel.com> In-Reply-To: <20201202185631.GQ4077@smile.fi.intel.com> From: Yun Levi Date: Thu, 3 Dec 2020 08:16:16 +0900 Message-ID: Subject: To: Andy Shevchenko Cc: Yury Norov , Rasmus Villemoes , dushistov@mail.ru, Arnd Bergmann , Andrew Morton , "Gustavo A. R. Silva" , William Breathitt Gray , richard.weiyang@linux.alibaba.com, joseph.qi@linux.alibaba.com, skalluru@marvell.com, Josh Poimboeuf , Linux Kernel Mailing List , linux-arch@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 3, 2020 at 3:55 AM Andy Shevchenko wrote: > > On Wed, Dec 02, 2020 at 08:51:27PM +0200, Andy Shevchenko wrote: > > On Thu, Dec 03, 2020 at 03:27:33AM +0900, Yun Levi wrote: > > > On Thu, Dec 3, 2020 at 2:36 AM Andy Shevchenko > > > wrote: > > > > On Wed, Dec 02, 2020 at 09:26:05AM -0800, Yury Norov wrote: > > ... > > > > > Side note: speaking of performance, any plans to fix for_each_*_bit*() for > > > > cases when the nbits is known to be <= BITS_PER_LONG? > > > > > > > > Now it makes an awful code generation (something like few hundred bytes of > > > > code). > > > > > Frankly Speaking, I don't have an idea in now..... > > > Could you share your idea or wisdom? > > > > Something like (I may be mistaken by names, etc, I'm not a compiler expert, > > and this is in pseudo language, I don't remember all API names by hart, > > just to express the idea) as a rough first step > > > > __builtin_constant(nbits, find_next_set_bit_long, find_next_set_bit) > > > > find_next_set_bit_long() > > { > > unsigned long v = BIT_LAST_WORD(i); > > return ffs_long(v); > > } > > I think this idea is hard to apply to find_next_set_bit. because __builtin_constant should be not only to size but also to offset. though we find size && offset is const under BITS_PER_LONG, I'm not sure it could be implemented as const expression.. > > Same for find_first_set_bit() -> map it to ffs_long(). > > > > And I believe it can be optimized more. In case of the find_first_set_bit, I think it would be possible, But I think it much better to separate as another patch set. So I want to focus on adding find_prev_*_bit, find_last_zero_bit to this patchset and mail-thread. Frankly speaking I need time to see that suggestion and think so, in next patch v2, it wouldn't be included. > > Btw it will also require to reconsider test cases where such constant small > nbits values are passed (forcing compiler to avoid optimization somehow, one > way is to try random nbits for some test cases). > > -- > With Best Regards, > Andy Shevchenko > > if my understanding and attitude are wrong, I really apologize for my rudeness and stubbornness but please let me know what thing is wrong. Sincerely Levi.