[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250507110701.c2c135d3f4ed594b914da41b@linux-foundation.org>
Date: Wed, 7 May 2025 11:07:01 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: WangYuli <wangyuli@...ontech.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org, yuzhao@...gle.com,
stevensd@...omium.org, kaleshsingh@...gle.com, zhanjun@...ontech.com,
niecheng1@...ontech.com, guanwentao@...ontech.com, Matthew Wilcox
<willy@...radead.org>
Subject: Re: [PATCH] mm: vmscan: Avoid signedness error for GCC 5.4
On Wed, 7 May 2025 12:06:11 +0800 WangYuli <wangyuli@...ontech.com> wrote:
> Perhaps a possible approach for now could be to change this line to for
> (i = tier % MAX_NR_TIERS; i <= min_t(int, tier, MAX_NR_TIERS - 1); i++)
> {, which would allow us to keep the signed int type for the tier
> variable itself.
Sure.
> Regarding the potential for a more comprehensive change in the future to
> redefine all these "tier" variables and related ones as unsigned int, I
> would be very grateful for your guidance on whether that's a direction
> we should consider.
`int' is a curse. Yes, we do this very frequently - we unthinkingly
use a signed type for a naturally unsigned concept. Ths signed type
spreads and spreads and the incorrect signage causes (small) problems
in various places. By then it's a big mess trying to switch to an
unsigned type.
Oh well, we just battle on. We should at least be more vigilant about
this when adding new things.
hp2:/usr/src/25> grep "int nid" mm/*.c | wc -l
316
argh.
Powered by blists - more mailing lists