From: WangYuli <wangyuli@uniontech.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
yuzhao@google.com, stevensd@chromium.org, kaleshsingh@google.com,
zhanjun@uniontech.com, niecheng1@uniontech.com,
guanwentao@uniontech.com, WangYuli <wangyuli@uniontech.com>
Subject: [PATCH] mm: vmscan: Avoid signedness error for GCC 5.4
Date: Wed, 7 May 2025 00:02:38 +0800 [thread overview]
Message-ID: <85050791B887DC13+20250506160238.799984-1-wangyuli@uniontech.com> (raw)
To the compiler, (MAX_NR_TIERS - 1) (i.e., (4U - 1)) is unsigned,
whereas tier is a signed integer.
GCC 5.4 does not permit the minimum operation on such
type-inconsistent operands.
Cast it to a signed integer to circumvent this compiler error.
Fix follow error with gcc 5.4:
mm/vmscan.c: In function ‘read_ctrl_pos’:
mm/vmscan.c:3166:728: error: call to ‘__compiletime_assert_887’ declared with attribute error: min(tier, 4U - 1) signedness error
Fixes: 37a260870f2c ("mm/mglru: rework type selection")
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
mm/vmscan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 3783e45bfc92..29dce1aed962 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3163,7 +3163,7 @@ static void read_ctrl_pos(struct lruvec *lruvec, int type, int tier, int gain,
pos->gain = gain;
pos->refaulted = pos->total = 0;
- for (i = tier % MAX_NR_TIERS; i <= min(tier, MAX_NR_TIERS - 1); i++) {
+ for (i = tier % MAX_NR_TIERS; i <= min(tier, (int)(MAX_NR_TIERS - 1)); i++) {
pos->refaulted += lrugen->avg_refaulted[type][i] +
atomic_long_read(&lrugen->refaulted[hist][type][i]);
pos->total += lrugen->avg_total[type][i] +
--
2.49.0
next reply other threads:[~2025-05-06 16:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 16:02 WangYuli [this message]
2025-05-06 16:22 ` Matthew Wilcox
2025-05-07 2:55 ` WangYuli
2025-05-07 20:46 ` David Laight
2025-05-07 12:06 ` David Laight
2025-05-06 23:24 ` Andrew Morton
2025-05-07 4:06 ` WangYuli
2025-05-07 18:07 ` Andrew Morton
2025-05-07 20:49 ` Matthew Wilcox
2025-05-10 10:24 ` David Laight
2025-05-15 15:11 ` WangYuli
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=85050791B887DC13+20250506160238.799984-1-wangyuli@uniontech.com \
--to=wangyuli@uniontech.com \
--cc=akpm@linux-foundation.org \
--cc=guanwentao@uniontech.com \
--cc=kaleshsingh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=niecheng1@uniontech.com \
--cc=stevensd@chromium.org \
--cc=yuzhao@google.com \
--cc=zhanjun@uniontech.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