[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1877ab0f14cf4f7d9da2a53e211cfdc1@AcuMS.aculab.com>
Date: Wed, 24 Jul 2024 11:05:17 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Lorenzo Stoakes' <lorenzo.stoakes@...cle.com>, Andrew Morton
<akpm@...ux-foundation.org>
CC: Arnd Bergmann <arnd@...nel.org>, "willy@...radead.org"
<willy@...radead.org>, "torvalds@...ux-foundation.org"
<torvalds@...ux-foundation.org>, "Jason@...c4.com" <Jason@...c4.com>,
"hch@...radead.org" <hch@...radead.org>, "andriy.shevchenko@...ux.intel.com"
<andriy.shevchenko@...ux.intel.com>, "pedro.falcato@...il.com"
<pedro.falcato@...il.com>, Mateusz Guzik <mjguzik@...il.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: Build performance regressions originating from min()/max() macros
From: Lorenzo Stoakes
> Sent: 24 July 2024 09:45
..
> It seems that (again, all credit to Arnd for his thorough analysis here) a
> lot of the underyling issue revolves around the macros need to function
> both in scenarios where we absolutely must have a constant value (for
> instance, array size) as well as in scenarios where this is not the case.
>
> Arnd also discovered [0] there _relatively_ few call sites that require
> this, so maybe a way forward might be to create specific min()/max() macros
> for the strictly const case and to fix up the core ones to reduce expansion
> at the cost of not being able to use these in these scenarios?
>
> Does this seem viable? Perhaps David you might have thoughts on this?
Indeed.
MIN() and MAX() could be used for compile-time constants (and require constants).
They would then be usable for static initialisers.
Before that can be done all the places that locally define MIN() and MAX()
need changing to either use min()/max() or surround the local definition
with an #ifdef until the global definition is added.
But there are some optimisations that can be done first.
The significant one is implement min3() directly (and probably without
the 'can be constant' logic.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists