From: Andrew Morton <akpm@linux-foundation.org>
To: David Hildenbrand <david@redhat.com>
Cc: Qingshuang Fu <fffsqian@163.com>,
hannes@cmpxchg.org, mhocko@kernel.org,
zhengqi.arch@bytedance.com, lorenzo.stoakes@oracle.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Qingshuang Fu <fuqingshuang@kylinos.cn>,
Yuanchu Xie <yuanchu@google.com>,
Axel Rasmussen <axelrasmussen@google.com>
Subject: Re: [PATCH] Fix the data type inconsistency issue of min (tier, MAX_CR_TIERS-1) in read_ctrl_pos
Date: Mon, 11 Aug 2025 21:40:53 -0700 [thread overview]
Message-ID: <20250811214053.857168fd35e70e73dee1583d@linux-foundation.org> (raw)
In-Reply-To: <91d72c49-22df-43ed-aeeb-0b93a9da3bfa@redhat.com>
On Fri, 8 Aug 2025 09:35:19 +0200 David Hildenbrand <david@redhat.com> wrote:
> >
> > Due to the fact that the tier data type in min (tier, MAX_CR_TIERS -1)
> > is int,but MAX_CR_TIERS is an unsigned type, directly using
> > the min function for comparison will result in an error:
> > from mm/vmscan.c:15:
> > mm/vmscan.c: In function ‘read_ctrl_pos’:
> > ./include/linux/build_bug.h:78:41: error: static assertion failed:
> > "min(tier, 4U - 1) signedness error, fix types or
> > consider umin() before min_t()"
> > And MAX_CR_TIERS is a macro definition defined as 4U,
> > so min_t can be used to convert it to int type before
> > performing the minimum value operation.
> >
>
> Please use empty lines to make the description easier to read. Also, I
> think you can simplify this heavily.
>
> We should add
>
> Fixes: 37a260870f2c ("mm/mglru: rework type selection")
I'm not liking read_ctrl_pos() much.
Local variable `i' has the rottenest possible name. In this case it is
a "tier", so let's call it that. And its type should be unsigned.
But an incoming arg has that name. Probably inappropriately. I'm
suspecting that something like base_tier or start_tier would be more
descriptive. Hard to tell, because read_ctrl_pos() forgot to get
documented. And this arg should have unsigned type also.
(cc mglru maintainers, who have yet to reveal themselves in MAINTAINERS)
next prev parent reply other threads:[~2025-08-12 4:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 7:21 Qingshuang Fu
2025-08-08 7:35 ` David Hildenbrand
[not found] ` <3d57fccc.8a13.1988900f06e.Coremail.fffsqian@163.com>
2025-08-08 9:32 ` David Hildenbrand
2025-08-12 4:40 ` Andrew Morton [this message]
2025-08-13 20:03 ` Axel Rasmussen
2025-08-13 21:41 ` Andrew Morton
2025-08-14 5:40 ` Lorenzo Stoakes
2025-08-14 11:51 ` David Laight
2025-08-14 21:26 ` David Laight
2025-08-08 7:34 Qingshuang Fu
2025-08-08 9:27 Qingshuang Fu
2025-08-08 9:42 ` David Hildenbrand
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=20250811214053.857168fd35e70e73dee1583d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=david@redhat.com \
--cc=fffsqian@163.com \
--cc=fuqingshuang@kylinos.cn \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@kernel.org \
--cc=yuanchu@google.com \
--cc=zhengqi.arch@bytedance.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®