Re: [PATCH 7/8] lib: add fast path for find_next_*_bit()
From: 'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>
Date: 2021-02-01 16:24:43
Also in:
linux-m68k, linux-sh, lkml
From: 'Andy Shevchenko' <andriy.shevchenko@linux.intel.com>
Date: 2021-02-01 16:24:43
Also in:
linux-m68k, linux-sh, lkml
On Mon, Feb 01, 2021 at 04:02:30PM +0000, David Laight wrote:
From: Andy Shevchenkoquoted
Sent: 01 February 2021 13:49 On Sat, Jan 30, 2021 at 11:17:18AM -0800, Yury Norov wrote:quoted
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