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

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 supporing 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().

Main changes for v2:
- Keep existing definition of __is_constexpr().
- Fix warning in signedness test for pointer types.
- Use __auto_type (From Arnd).

David Laight (8):
  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: Use __auto_type
  minmax: minmax: Add __types_ok3() and optimise defines with 3
    arguments

 include/linux/compiler.h |  17 ++++
 include/linux/minmax.h   | 188 +++++++++++++++++++++------------------
 2 files changed, 117 insertions(+), 88 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] 50+ messages in thread

end of thread, other threads:[~2024-12-04 17:17 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-28 14:15 [PATCH v2 0/8] minmax: reduce compilation time David Laight
2024-07-28 14:17 ` [PATCH v2 1/8] minmax: Put all the clamp() definitions together David Laight
2024-07-28 17:24   ` Linus Torvalds
2024-07-28 18:11     ` David Laight
2024-07-28 19:55       ` Linus Torvalds
2024-07-28 20:09         ` David Laight
2024-07-28 20:13           ` Linus Torvalds
2024-07-28 20:22             ` David Laight
2024-07-28 20:31               ` Linus Torvalds
2024-07-28 22:13                 ` David Laight
2024-07-28 22:22                   ` Linus Torvalds
2024-07-29  8:01                     ` David Laight
2024-07-28 21:01               ` Linus Torvalds
2024-07-28 21:53                 ` David Laight
2024-07-29  4:15                 ` Linus Torvalds
2024-07-29 22:25             ` Arnd Bergmann
2024-07-29 23:21               ` Linus Torvalds
2024-07-30  1:52                 ` Linus Torvalds
2024-07-30  3:59                 ` Linus Torvalds
2024-07-30 10:10                   ` Arnd Bergmann
2024-07-30 14:14                     ` Arnd Bergmann
2024-07-30 18:02                       ` Linus Torvalds
2024-07-30 19:52                         ` Linus Torvalds
2024-07-30 21:47                           ` David Laight
2024-07-30 22:44                             ` Linus Torvalds
2024-07-30 23:03                               ` Linus Torvalds
2024-07-31  8:09                                 ` David Laight
2024-07-31 10:50                                   ` Arnd Bergmann
2024-07-31 15:38                                   ` Linus Torvalds
2024-07-31 15:56                                     ` David Laight
2024-07-31 16:04                                       ` Linus Torvalds
2024-12-04 13:15                       ` Geert Uytterhoeven
2024-12-04 17:16                         ` David Laight
2024-07-30 16:35                     ` Linus Torvalds
2024-07-30 16:46                       ` Linus Torvalds
2024-07-30 12:03               ` David Laight
2024-07-28 18:23     ` David Laight
2024-07-28 14:18 ` [PATCH v2 2/8] minmax: Use _Static_assert() instead of static_assert() David Laight
2024-07-28 17:51   ` Christophe JAILLET
2024-07-28 18:12     ` David Laight
2024-07-28 14:19 ` [PATCH v2 3/8] compiler.h: Add __if_constexpr(expr, if_const, if_not_const) David Laight
2024-07-28 14:20 ` [PATCH v2 4/8] minmax: Simplify signedness check David Laight
2024-07-28 16:57   ` Linus Torvalds
2024-07-28 18:14     ` David Laight
2024-07-28 20:13       ` David Laight
2024-07-28 14:21 ` [PATCH v2 5/8] minmax: Factor out the zero-extension logic from umin/umax David Laight
2024-07-28 14:22 ` [PATCH v2 6/8] minmax: Optimise _Static_assert() check in clamp() David Laight
2024-07-28 14:23 ` [PATCH v2 7/8] minmax: Use __auto_type David Laight
2024-07-28 16:59   ` Linus Torvalds
2024-07-28 14:24 ` [PATCH v2 8/8] minmax: minmax: Add __types_ok3() and optimise defines with 3 arguments David Laight

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