Re: [PATCH] mm: vmscan: Avoid signedness error for GCC 5.4

WangYuli
2025-05-07T02:56:27Z

[-- Attachment #1.1.1: Type: text/plain, Size: 844 bytes --]

Hi Matthew Wilcox and Andrew Morton,

On 2025/5/7 00:22, Matthew Wilcox wrote:
> 1. This has nothing to do with the compiler version; the type-checking
> is built into min().

Thank you for pointing that out! My previous statement was incorrect.

The error is actually from the __types_ok check within the
__careful_cmp_once macro failing, which triggered BUILD_BUG_ON.

But then, why do newer compilers compile this without error? Is it
perhaps because they consider 4U - 1 to be signed?

> 2. We have min_t for a reason
Yes, using min_t instead of min is a better approach.
> 3. Why is a signed min the right answer instead of an unsigned min?
>
That is indeed false. Just as Andrew Morton said, "negative tier numbers
are nonsensical".

Thank you for everyone's corrections. I'll submit a v2 patch.

--
WangYuli

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 645 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]