linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] minmax: reduce compilation time
@ 2024-07-24 14:26 David Laight
  2024-07-24 14:28 ` [PATCH 1/7] minmax: Put all the clamp() definitions together David Laight
                   ` (7 more replies)
  0 siblings, 8 replies; 58+ messages in thread
From: David Laight @ 2024-07-24 14:26 UTC (permalink / raw)
  To: linux-kernel, Linus Torvalds
  Cc: 'Matthew Wilcox (Oracle)', 'Christoph Hellwig',
	'Andrew Morton', 'Andy Shevchenko',
	'Dan Carpenter', 'Arnd Bergmann',
	'Jason@zx2c4.com', 'hch@infradead.org',
	'pedro.falcato@gmail.com', 'Mateusz Guzik',
	'linux-mm@kvack.org'

The changes to minmax.h that changed the type check to a signedness
check significantly increased the length of the expansion.
In some cases it has also significantly increased compile type.
This is particularly noticeable for nested expansions.

These changes reduce the expansions somewhat.
The biggest change is the last patch that directly implements
min3() and max3() rather than using a nested expansion.

Further significant improvements can be made by removing the
requirement that min(1,2) be 'constant enough' for an array size.
Instead supporting MIN() and MAX() for constants only with a result
that is valid for a static initialiser.
However that needs an initial change to the few files that have
local versions of MIN() or MAX().


David Laight (7):
  minmax: Put all the clamp() definitions together
  minmax: Use _Static_assert() instead of static_assert()
  compiler.h: Add __if_constexpr(expr, if_const, if_not_const)
  minmax: Simplify signedness check
  minmax: Factor out the zero-extension logic from umin/umax.
  minmax: Optimise _Static_assert() check in clamp().
  minmax: minmax: Add __types_ok3() and optimise defines with 3
    arguments

 include/linux/compiler.h |  65 +++++----------
 include/linux/minmax.h   | 176 ++++++++++++++++++++-------------------
 2 files changed, 113 insertions(+), 128 deletions(-)

-- 
2.17.1

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)



^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2024-07-30 10:37 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-24 14:26 [PATCH 0/7] minmax: reduce compilation time David Laight
2024-07-24 14:28 ` [PATCH 1/7] minmax: Put all the clamp() definitions together David Laight
2024-07-24 14:29 ` [PATCH 2/7] minmax: Use _Static_assert() instead of static_assert() David Laight
2024-07-24 14:29 ` [PATCH 3/7] compiler.h: Add __if_constexpr(expr, if_const, if_not_const) David Laight
2024-07-24 17:32   ` Arnd Bergmann
2024-07-25  9:12     ` David Laight
2024-07-24 19:48   ` Linus Torvalds
2024-07-25  8:45     ` David Laight
2024-07-24 14:30 ` [PATCH 4/7] minmax: Simplify signedness check David Laight
2024-07-24 16:48   ` Arnd Bergmann
2024-07-24 20:02     ` Linus Torvalds
2024-07-25  9:00       ` David Laight
2024-07-25 17:02         ` Linus Torvalds
2024-07-26  9:43           ` Lorenzo Stoakes
2024-07-26 12:57             ` David Laight
2024-07-26 13:27               ` Lorenzo Stoakes
2024-07-25 13:24   ` kernel test robot
2024-07-25 16:39     ` David Laight
2024-07-24 14:31 ` [PATCH 5/7] minmax: Factor out the zero-extension logic from umin/umax David Laight
2024-07-24 14:32 ` [PATCH 6/7] minmax: Optimise _Static_assert() check in clamp() David Laight
2024-07-24 14:33 ` [PATCH 7/7] minmax: minmax: Add __types_ok3() and optimise defines with 3 arguments David Laight
2024-07-24 17:03   ` Arnd Bergmann
2024-07-25  9:07     ` David Laight
2024-07-24 19:34 ` [PATCH 0/7] minmax: reduce compilation time Lorenzo Stoakes
2024-07-24 19:52   ` Linus Torvalds
2024-07-26 18:12     ` Lorenzo Stoakes
2024-07-26 18:24       ` Linus Torvalds
2024-07-26 18:56         ` Lorenzo Stoakes
2024-07-26 19:21           ` Lorenzo Stoakes
2024-07-26 21:36             ` Linus Torvalds
2024-07-26 21:46               ` Jens Axboe
2024-07-26 22:48               ` Linus Torvalds
2024-07-27 15:30                 ` Jens Axboe
2024-07-27 15:38                   ` Jens Axboe
2024-07-27 16:31                     ` Lorenzo Stoakes
2024-07-27 16:36                       ` Jens Axboe
2024-07-27 16:41                         ` Lorenzo Stoakes
2024-07-27 16:52                           ` Jens Axboe
2024-07-27 16:56                             ` Lorenzo Stoakes
2024-07-28 11:32                       ` David Laight
2024-07-27  4:13               ` Linus Torvalds
2024-07-27  4:14                 ` Linus Torvalds
2024-07-27  8:08                 ` David Laight
2024-07-27 18:58                   ` Lorenzo Stoakes
2024-07-27 19:21                     ` Linus Torvalds
2024-07-28 11:17                     ` David Laight
2024-07-28 13:07                       ` Lorenzo Stoakes
2024-07-27 17:33                 ` Matthew Wilcox
2024-07-27 18:16                   ` Linus Torvalds
2024-07-27  8:07             ` Lorenzo Stoakes
2024-07-27 16:26               ` Linus Torvalds
2024-07-27 18:44                 ` Lorenzo Stoakes
2024-07-30  4:10                 ` Linus Torvalds
2024-07-30 10:36                   ` Arnd Bergmann
2024-07-28 17:57           ` Geert Uytterhoeven
2024-07-28 18:43             ` Lorenzo Stoakes
2024-07-26 21:32         ` David Laight
2024-07-26 21:38           ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox