From: David Laight <david.laight.linux@gmail.com>
To: Eliav Farber <farbere@amazon.com>
Cc: <luc.vanoostenryck@gmail.com>, <rostedt@goodmis.org>,
<mingo@redhat.com>, <akpm@linux-foundation.org>,
<gregkh@linuxfoundation.org>, <sj@kernel.org>,
<David.Laight@ACULAB.COM>, <Jason@zx2c4.com>,
<andriy.shevchenko@linux.intel.com>, <bvanassche@acm.org>,
<keescook@chromium.org>, <linux-sparse@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <jonnyc@amazon.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH 0/7 5.10.y] Cherry pick of minmax.h commits from 5.15.y
Date: Thu, 18 Sep 2025 22:01:06 +0100 [thread overview]
Message-ID: <20250918220106.75a8191b@pumpkin> (raw)
In-Reply-To: <20250916212259.48517-1-farbere@amazon.com>
On Tue, 16 Sep 2025 21:22:52 +0000
Eliav Farber <farbere@amazon.com> wrote:
> This series backports seven commits from v5.15.y that update minmax.h
> and related code:
>
> - ed6e37e30826 ("tracing: Define the is_signed_type() macro once")
> - 998f03984e25 ("minmax: sanity check constant bounds when clamping")
> - d470787b25e6 ("minmax: clamp more efficiently by avoiding extra
> comparison")
> - 1c2ee5bc9f11 ("minmax: fix header inclusions")
> - d53b5d862acd ("minmax: allow min()/max()/clamp() if the arguments
> have the same signedness.")
> - 7ed91c5560df ("minmax: allow comparisons of 'int' against 'unsigned
> char/short'")
> - 22f7794ef5a3 ("minmax: relax check to allow comparison between
> unsigned arguments and signed constants")
I think you need to pick up the later changes (from Linus) as well.
Without them nested min() and max() can generate very long lines from
the pre-processor (tens of megabytes) that cause very slow and/or
failing compilations on 32bit and other memory-limited systems.
There are a few other changes needed at the same time.
The current min() and max() can't be used in a few places because
they aren't 'constant enough' with constant arguments.
David
>
> The main motivation is commit d53b5d862acd, which removes the strict
> type check in min()/max() when both arguments have the same signedness.
> Without this, kernel 5.10 builds can emit warnings that become build
> failures when -Werror is used.
>
> Additionally, commit ed6e37e30826 from tracing is required as a
> dependency; without it, compilation fails.
>
> Andy Shevchenko (1):
> minmax: fix header inclusions
>
> Bart Van Assche (1):
> tracing: Define the is_signed_type() macro once
>
> David Laight (3):
> minmax: allow min()/max()/clamp() if the arguments have the same
> signedness.
> minmax: allow comparisons of 'int' against 'unsigned char/short'
> minmax: relax check to allow comparison between unsigned arguments and
> signed constants
>
> Jason A. Donenfeld (2):
> minmax: sanity check constant bounds when clamping
> minmax: clamp more efficiently by avoiding extra comparison
>
> include/linux/compiler.h | 6 +++
> include/linux/minmax.h | 89 ++++++++++++++++++++++++++----------
> include/linux/overflow.h | 1 -
> include/linux/trace_events.h | 2 -
> 4 files changed, 70 insertions(+), 28 deletions(-)
>
next prev parent reply other threads:[~2025-09-18 21:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-16 21:22 [PATCH 0/7 5.10.y] Cherry pick of minmax.h commits from 5.15.y Eliav Farber
2025-09-16 21:22 ` [PATCH 1/7 5.10.y] tracing: Define the is_signed_type() macro once Eliav Farber
2025-09-17 8:40 ` Greg KH
2025-09-17 10:37 ` Farber, Eliav
2025-09-21 17:30 ` Greg KH
2025-09-16 21:22 ` [PATCH 2/7 5.10.y] minmax: sanity check constant bounds when clamping Eliav Farber
2025-09-16 21:22 ` [PATCH 3/7 5.10.y] minmax: clamp more efficiently by avoiding extra comparison Eliav Farber
2025-09-16 21:22 ` [PATCH 4/7 5.10.y] minmax: fix header inclusions Eliav Farber
2025-09-18 21:01 ` David Laight [this message]
2025-09-19 10:41 ` [PATCH 0/7 5.10.y] Cherry pick of minmax.h commits from 5.15.y Farber, Eliav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250918220106.75a8191b@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=Jason@zx2c4.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bvanassche@acm.org \
--cc=farbere@amazon.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonnyc@amazon.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=sj@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.