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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B0F1C433E0 for ; Mon, 1 Feb 2021 16:24:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D85464D9D for ; Mon, 1 Feb 2021 16:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbhBAQY0 (ORCPT ); Mon, 1 Feb 2021 11:24:26 -0500 Received: from mga09.intel.com ([134.134.136.24]:29698 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbhBAQYZ (ORCPT ); Mon, 1 Feb 2021 11:24:25 -0500 IronPort-SDR: emSQniScOxAxSCmM7/qcS8sSWrDDmo0/a5iHdRJMrWhKkDZdOWOnphNOfTV5RqIhHZUqaGF38S /DR+MHXQHrMA== X-IronPort-AV: E=McAfee;i="6000,8403,9882"; a="180854790" X-IronPort-AV: E=Sophos;i="5.79,392,1602572400"; d="scan'208";a="180854790" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 08:22:36 -0800 IronPort-SDR: k6s+zarLevdYJoLssP9Apm++1N99I6/o1hRQHcqf1zrR51lrlo+Qa0FTOdbd2TDBVRXdYHy3jF PTC+iN9sxPiQ== X-IronPort-AV: E=Sophos;i="5.79,392,1602572400"; d="scan'208";a="412816627" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2021 08:22:31 -0800 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1l6by7-001Als-Ig; Mon, 01 Feb 2021 18:22:27 +0200 Date: Mon, 1 Feb 2021 18:22:27 +0200 From: 'Andy Shevchenko' To: David Laight Cc: Yury Norov , "linux-m68k@lists.linux-m68k.org" , "linux-kernel@vger.kernel.org" , "linux-sh@vger.kernel.org" , "linux-arch@vger.kernel.org" , Geert Uytterhoeven , Yoshinori Sato , Rich Felker , Arnd Bergmann , Dennis Zhou , Andrew Morton , Wolfram Sang , David Sterba , Stefano Brivio , "Ma, Jianpeng" , Wei Yang , Josh Poimboeuf , John Paul Adrian Glaubitz , Joe Perches Subject: Re: [PATCH 7/8] lib: add fast path for find_next_*_bit() Message-ID: References: <20210130191719.7085-1-yury.norov@gmail.com> <20210130191719.7085-8-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org On Mon, Feb 01, 2021 at 04:02:30PM +0000, David Laight wrote: > From: Andy Shevchenko > > Sent: 01 February 2021 13:49 > > On Sat, Jan 30, 2021 at 11:17:18AM -0800, Yury Norov wrote: > > > Similarly to bitmap functions, find_next_*_bit() users will benefit > > > if we'll handle a case of bitmaps that fit into a single word. In the > > > very best case, the compiler may replace a function call with a > > > single ffs or ffz instruction. > > > > Would be nice to have the examples how it reduces the actual code size (based > > on the existing code in kernel, especially in widely used frameworks / > > subsystems, like PCI). > > I bet it makes the kernel bigger but very slightly faster. > But the fact that the wrappers end up in the i-cache may > mean that inlining actually makes it slower for some calling > sequences. > If a bitmap fits in a single word (as a compile-time constant) > then you should (probably) be using different functions if > you care about performance. Isn't this patch series exactly about it? -- With Best Regards, Andy Shevchenko