Re: [PATCH 08/14] lib/Kconfig: introduce FAST_PATH option

Andy Shevchenko
2021-02-19T10:58:30Z

On Thu, Feb 18, 2021 at 11:24:19AM -0800, Yury Norov wrote:
> On Thu, Feb 18, 2021 at 05:15:43PM +0200, Andy Shevchenko wrote:
> > On Wed, Feb 17, 2021 at 08:05:06PM -0800, Yury Norov wrote:
> > > This series introduces fast paths for find_bit() routines. It is
> > > beneficial for typical systems, but those who limited in I-cache
> > > may be concerned about increasing the .text size of the Image.
> > >
> > > To address this concern, one can disable FAST_PATH option in the config
> > > and some save memory.
> > >
> > > The effect of this option on my arm64 next-20210217 build is:
> >
> > (Maybe bloat-o-meter will give better view on this, i.e. more human-readable)
>
> Never heard about this tool, thanks for the hint.
>
> scripts/bloat-o-meter vmlinux vmlinux.new
> add/remove: 16/13 grow/shrink: 111/439 up/down: 3616/-19352 (-15736)
> Function old new delta
> find_next_bit.constprop - 220 +220
> apply_wqattrs_cleanup - 176 +176
> memcg_free_shrinker_maps - 172 +172
> ...
> cpuset_hotplug_workfn 2584 2288 -296
> task_numa_fault 3640 3320 -320
> kmem_cache_free_bulk 1684 1280 -404
> Total: Before=26085140, After=26069404, chg -0.06%
>
> The complete output is here:
> https://pastebin.com/kBSdVJcK
>
> So if I understand the output correctly, the size of .text is decreased...
> Looks weird, but if it's true, we don't need the FAST_BIT config at all
> because there's no tradeoff, and I should drop the patch.

I actually expected the text size decrease when it's about constants.
I remember that in PCI case we discussed with Bjorn the use of
for_each_set_bit() that brought entire function into the object file that
increased it by ~300 bytes (or so). But the code is something like

for_each_set_bit(i, &addr, 32)

...

> > I think the name is to broad for this cases, perhaps BITS_FAST_PATH? or BITMAP?
>
> My logic was that since SMALL_CONST() is global, and FAST_PATH
> controls the SMALL_CONST, it should also be global. I believe,
> Linux should have a global switch to control the behaviour in
> such cases, similarly to -Os compiler option. And I was surprized
> when I found nothing like FAST_PATH in the config.
>
> What about having FAST_PATH as a global option, and later if someone
> will request for granularity, we'll introduce nested configs?

I think it is too far from now. Let's do one step at a time.

--
With Best Regards,
Andy Shevchenko