linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: fffsqian  <fffsqian@163.com>
To: "David Hildenbrand" <david@redhat.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org,
	zhengqi.arch@bytedance.com, shakeel.butt@linux.dev,
	lorenzo.stoakes@oracle.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	"Qingshuang Fu" <fuqingshuang@kylinos.cn>
Subject: Re:Re: [PATCH v2] Fix the data type inconsistency issue of min (tier, MAX_CR_TIERS-1) in read_ctrl_pos
Date: Mon, 11 Aug 2025 10:37:20 +0800 (CST)	[thread overview]
Message-ID: <15cf5f42.2861.19896fd50f6.Coremail.fffsqian@163.com> (raw)
In-Reply-To: <985a0cf8-b6d5-452f-9afc-4c04a86bae64@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 5503 bytes --]

Hi David,

I'm really sorry, I just submitted the patch for version V2 and didn't notice your reply email. Here is an explanation about the environment used for compilation:

Firstly, I opened the configuration startup option CONFIG_WERROR=y

Secondly, when I tested with versions 9.4.0 and 12.3.1 of gcc, I encountered errors:




$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
$ make mm/vmscan.o
  CALL    scripts/checksyscalls.sh
  DESCEND bpf/resolve_btfids
  INSTALL libsubcmd_headers
  CC      mm/vmscan.o
In file included from ./include/linux/init.h:5,
                 from ./include/linux/printk.h:6,
                 from ./include/asm-generic/bug.h:22,
                 from ./arch/arm64/include/asm/bug.h:26,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/mm.h:6,
                 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()"
   78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
      |                                         ^~~~~~~~~~~~~~
./include/linux/build_bug.h:77:34: note: in expansion of macro ‘__static_assert’
   77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
      |                                  ^~~~~~~~~~~~~~~
./include/linux/minmax.h:51:2: note: in expansion of macro ‘static_assert’
   51 |  static_assert(__types_ok(x, y),   \
      |  ^~~~~~~~~~~~~
./include/linux/minmax.h:58:3: note: in expansion of macro ‘__cmp_once’
   58 |   __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
      |   ^~~~~~~~~~
./include/linux/minmax.h:85:19: note: in expansion of macro ‘__careful_cmp’
   85 | #define min(x, y) __careful_cmp(min, x, y)
      |                   ^~~~~~~~~~~~~
mm/vmscan.c:3098:37: note: in expansion of macro ‘min’
 3098 |  for (i = tier % MAX_NR_TIERS; i <= min(tier, MAX_NR_TIERS - 1); i++) {
      |                                     ^~~
make[3]: *** [scripts/Makefile.build:243: mm/vmscan.o] Error 1
make[2]: *** [scripts/Makefile.build:480: mm] Error 2
make[1]: *** [/home/user/fffs/klinux/Makefile:1944: .] Error 2
make: *** [Makefile:236: __sub-make] Error 2





$ gcc --version
gcc (GCC) 12.3.1 (kylin 12.3.1-31.p02.ky11)
$ make mm/vmscan.o
  CALL    scripts/checksyscalls.sh
  DESCEND bpf/resolve_btfids
make[4]: “install_headers”is already the latest.
  CC      mm/vmscan.o
In file included from ./include/linux/init.h:5,
                 from ./include/linux/printk.h:6,
                 from ./include/asm-generic/bug.h:22,
                 from ./arch/arm64/include/asm/bug.h:26,
                 from ./include/linux/bug.h:5,
                 from ./include/linux/mmdebug.h:5,
                 from ./include/linux/mm.h:6,
                 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()"
   78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
      |                                         ^~~~~~~~~~~~~~
./include/linux/build_bug.h:77:34: note:in expansion of macro ‘__static_assert’
   77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
      |                                  ^~~~~~~~~~~~~~~
./include/linux/minmax.h:51:9: note:in expansion of macro ‘static_assert’
   51 |         static_assert(__types_ok(x, y),                 \
      |         ^~~~~~~~~~~~~
./include/linux/minmax.h:58:17: note:in expansion of macro ‘__cmp_once’
   58 |                 __cmp_once(op, x, y, __UNIQUE_ID(__x), __UNIQUE_ID(__y)))
      |                 ^~~~~~~~~~
./include/linux/minmax.h:85:25: note:in expansion of macro ‘__careful_cmp’
   85 | #define min(x, y)       __careful_cmp(min, x, y)
      |                         ^~~~~~~~~~~~~
mm/vmscan.c:3098:44: note:in expansion of macro ‘min’
 3098 |         for (i = tier % MAX_NR_TIERS; i <= min(tier, MAX_NR_TIERS - 1); i++) {
      |                                            ^~~
make[3]: *** [scripts/Makefile.build:243:mm/vmscan.o] Error 1
make[2]: *** [scripts/Makefile.build:480:mm] Error 2
make[1]: *** [/root/fffs/klinux/Makefile:1944:.] Error2
make: *** [Makefile:236:__sub-make] Error 2




Sorry again.

















At 2025-08-08 17:58:31, "David Hildenbrand" <david@redhat.com> wrote:
>On 08.08.25 11:54, Qingshuang Fu wrote:
>> From: Qingshuang Fu <fuqingshuang@kylinos.cn>
>> 
>> 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()"
>> 
>> Fixes: 37a260870f2c ("mm/mglru: rework type selection")
>> Suggested-by: David Hildenbrand <david@redhat.com>
>
>You keep ignoring my feedback and I can only reproduce this with W=2 
>where there are like a bunch of other issues, this here doesn't move the 
>needle.
>
>So I'm afraid I cannot spend any more time on reviewing this patch.
>
>NAK
>
>-- 
>Cheers,
>
>David / dhildenb

[-- Attachment #2: Type: text/html, Size: 72815 bytes --]

      reply	other threads:[~2025-08-11  2:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08  9:54 Qingshuang Fu
2025-08-08  9:58 ` David Hildenbrand
2025-08-11  2:37   ` fffsqian [this message]

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=15cf5f42.2861.19896fd50f6.Coremail.fffsqian@163.com \
    --to=fffsqian@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.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=shakeel.butt@linux.dev \
    --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