Re: [PATCH] mm/vmscan: avoid false-positive -Wuninitialized warning, again
From: Arnd Bergmann
Date: Thu Sep 17 2026 - 01:51:23 EST
On Thu, Sep 17, 2026, at 01:30, Andrew Morton wrote:
> On Wed, 16 Sep 2026 16:28:16 -0700 Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>> >
>> > --- a/mm/vmscan.c
>> > +++ b/mm/vmscan.c
>> > @@ -3274,8 +3274,10 @@ struct ctrl_pos {
>> > int gain;
>> > };
>> >
>> > -static void read_ctrl_pos(struct lruvec *lruvec, int type, int tier_min,
>> > - int tier_max, int gain, struct ctrl_pos *pos)
>> > +/* __noipa works around gcc-16 warning for uninitizled use of pos->refaulted */
>> > +static __noipa void read_ctrl_pos(struct lruvec *lruvec, int type,
>> > + int tier_min, int tier_max, int gain,
>> > + struct ctrl_pos *pos)
>> > {
>> > int i;
>> > struct lru_gen_folio *lrugen = &lruvec->lrugen;
>>
>> Current code has changed here somewhat, but I expect the error is still
>> there. I fixed that "uninitizled" while in there. Altered patch is
>> below.
>
>
> Then the build blew up in unexpected ways. gcc-15.2.0.
>
> The failure looks like a legit min() signedness thing which has been
> there quite a while. I'm thinking that __noipa surfaced this for some
> reason?
Right, I now saw the same thing here on the current linux-next.
What I found now is that the __noipa is only needed on top of
"mm/mglru: use explicit tier range in read_ctrl_pos()", which was
in next-20260915 but disappeared in next-20260916. This patch
also removed the min().
I think the reason why __noipa causes the warning about min() is
that it prevents the constant propagation into read_ctrl_pos() and
in turn the hack that suppresses warning about mixed types in
minmax.h when both sides are constant.
Is the mglru series currently expected to make it into 7.4?
If not, I would withdraw my __noipa and hope that the next
round of changes to read_ctrl_pos() does not run into this
problem again.
Arnd