From: sashiko-bot@kernel.org
To: "Eric Curtin" <ericcurtin17@gmail.com>
Cc: "Ryan Roberts" <ryan.roberts@arm.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Richard Weinberger" <richard@nod.at>,
"Vignesh Raghavendra" <vigneshr@ti.com>,
"Dan Williams" <djbw@kernel.org>,
"Vishal Verma" <vishal.l.verma@intel.com>,
"Dave Jiang" <dave.jiang@intel.com>,
"Alison Schofield" <alison.schofield@intel.com>,
"Ira Weiny" <iweiny@kernel.org>,
"David Hildenbrand" <david@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
"Vlastimil Babka" <vbabka@kernel.org>,
"Mike Rapoport" <rppt@kernel.org>,
"Michal Hocko" <mhocko@suse.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Kairui Song" <kasong@tencent.com>,
"Barry Song" <baohua@kernel.org>, "Qi Zheng" <qi.zheng@linux.dev>,
"Shakeel Butt" <shakeel.butt@linux.dev>,
"Axel Rasmussen" <axelrasmussen@google.com>,
"Yuanchu Xie" <yuanchu@google.com>, "Wei Xu" <weixugc@google.com>,
"Baoquan He" <baoquan.he@linux.dev>,
"Baolin Wang" <baolin.wang@linux.alibaba.com>,
"Harry Yoo" <harry@kernel.org>, "Hao Li" <hao.li@linux.dev>,
"Christoph Lameter" <cl@gentwo.org>,
"David Rientjes" <rientjes@google.com>,
"Roman Gushchin" <roman.gushchin@linux.dev>,
"Chris Li" <chrisl@kernel.org>,
"Kemeng Shi" <shikemeng@huaweicloud.com>,
"Nhat Pham" <nphamcs@gmail.com>,
"Youngjun Park" <youngjun.park@lge.com>,
"Zi Yan" <ziy@nvidia.com>, "Nico Pache" <nico.pache@linux.dev>,
"Dev Jain" <dev.jain@arm.com>,
"Lance Yang" <lance.yang@linux.dev>,
"Usama Arif" <usama.arif@linux.dev>,
"Kiryl Shutsemau" <kas@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Muchun Song" <muchun.song@linux.dev>,
"Lorenzo Stoakes" <ljs@kernel.org>,
"Suren Baghdasaryan" <surenb@google.com>,
"Pedro Falcato" <pfalcato@suse.de>,
"Jann Horn" <jannh@google.com>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
"Jan Kara" <jack@suse.cz>, "Uladzislau Rezki" <urezki@gmail.com>,
linux-mtd@lists.infradead.org, nvdimm@lists.linux.dev,
linux-mm@kvack.org, tj@kernel.org, mkoutny@suse.com
Subject: Re: [RFC PATCH v2 13/13] mm: Use PAGE_SIZE_MIN/MAX where a compile-time constant is required
Date: Thu, 03 Dec 2026 03:17:46 +0000 [thread overview]
Message-ID: <sashiko-outbox-247085@kernel.org> (raw)
In-Reply-To: <20261202031647.1690622-14-ericcurtin17@gmail.com>
Thank you for your contribution! Sashiko AI review found 4 potential
issues to consider:
- [High] mm: build failure due to undefined PAGE_SIZE_MIN/MAX and global
var macros
- [Medium] nvdimm: ND_MIN_NAMESPACE_SIZE remains an enum constant in
include/linux/ndctl.h
- [Medium] mm: unconverted PAGE_SIZE preprocessor checks in struct
page_frag_cache
- [Medium] mm: shmem: unconverted file-scope str_dup[PAGE_SIZE] in
setup_thp_shmem()
--
commit 1cac4650f751e6c541c62da4b800a07041aadd02
Author: Ryan Roberts <ryan.roberts@arm.com>
mm: Use PAGE_SIZE_MIN/MAX where a compile-time constant is required
This commit replaces compile-time uses of PAGE_SIZE and PAGE_SHIFT in the
mm subsystem with PAGE_SIZE_MIN/MAX, PAGE_SHIFT_MIN/MAX, and runtime
page-size global variable helpers to support boot-time page size
selection.
> diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
> index 3aa0a9026efa8..10d5ce31eb4f1 100644
> --- a/drivers/nvdimm/namespace_devs.c
> +++ b/drivers/nvdimm/namespace_devs.c
> @@ -1478,8 +1478,8 @@ struct nd_namespace_common *nvdimm_namespace_common_probe(struct device *dev)
>
> size = nvdimm_namespace_capacity(ndns);
> if (size < ND_MIN_NAMESPACE_SIZE) {
> - dev_dbg(&ndns->dev, "%pa, too small must be at least %#x\n",
> - &size, ND_MIN_NAMESPACE_SIZE);
> + dev_dbg(&ndns->dev, "%pa, too small must be at least %#lx\n",
> + &size, (unsigned long)ND_MIN_NAMESPACE_SIZE);
> return ERR_PTR(-ENODEV);
> }
[Severity: Medium]
Should ND_MIN_NAMESPACE_SIZE in include/linux/ndctl.h also be converted
from an enum constant to a macro?
include/linux/ndctl.h still defines:
enum {
ND_MIN_NAMESPACE_SIZE = PAGE_SIZE,
};
Because C requires enumerator values to be integer constant expressions,
compiling include/linux/ndctl.h will fail when PAGE_SIZE is not a
compile-time constant.
[ ... ]
> diff --git a/include/linux/mm_types_task.h b/include/linux/mm_types_task.h
> index 11bf319d78ecb..37fa179e8ae18 100644
> --- a/include/linux/mm_types_task.h
> +++ b/include/linux/mm_types_task.h
> @@ -35,7 +35,7 @@ struct page;
>
> struct page_frag {
> struct page *page;
> -#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)
> +#if (BITS_PER_LONG > 32) || (PAGE_SIZE_MAX >= 65536)
> __u32 offset;
> __u32 size;
> #else
[Severity: Medium]
Does struct page_frag_cache just below this in include/linux/mm_types_task.h
(along with include/linux/page_frag_cache.h and mm/page_frag_cache.c)
also need conversion to PAGE_SIZE_MAX?
include/linux/mm_types_task.h defines:
#define PAGE_FRAG_CACHE_MAX_SIZE __ALIGN_MASK(32768, ~PAGE_MASK)
#define PAGE_FRAG_CACHE_MAX_ORDER get_order(PAGE_FRAG_CACHE_MAX_SIZE)
struct page_frag_cache {
...
#if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) && (BITS_PER_LONG <= 32)
Because (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) is evaluated first by the
preprocessor on all architectures, non-constant PAGE_SIZE and PAGE_MASK
will break preprocessing of include/linux/mm_types_task.h,
include/linux/page_frag_cache.h, and the BUILD_BUG_ON() checks in
mm/page_frag_cache.c:encoded_page_create().
[ ... ]
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index cda126def67af..8078eb3eb0f5d 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -653,7 +653,7 @@ static inline unsigned int arch_slab_minalign(void)
> */
> #define __assume_kmalloc_alignment __assume_aligned(ARCH_KMALLOC_MINALIGN)
> #define __assume_slab_alignment __assume_aligned(ARCH_SLAB_MINALIGN)
> -#define __assume_page_alignment __assume_aligned(PAGE_SIZE)
> +#define __assume_page_alignment __assume_aligned(PAGE_SIZE_MIN)
>
> /*
> * Kmalloc array related definitions
> @@ -664,6 +664,8 @@ static inline unsigned int arch_slab_minalign(void)
> * (PAGE_SIZE*2). Larger requests are passed to the page allocator.
> */
> #define KMALLOC_SHIFT_HIGH (PAGE_SHIFT + 1)
> +#define KMALLOC_SHIFT_HIGH_MIN (PAGE_SHIFT_MIN + 1)
> +#define KMALLOC_SHIFT_HIGH_MAX (PAGE_SHIFT_MAX + 1)
[Severity: High]
Are the prerequisite definitions for PAGE_SIZE_MIN, PAGE_SIZE_MAX,
PAGE_SHIFT_MIN, PAGE_SHIFT_MAX, and DEFINE_GLOBAL_PAGE_SIZE_VAR*() missing
from this tree?
None of those macros are defined in the repository, so the build fails
across include/linux/slab.h, include/linux/mm.h, include/linux/mmzone.h,
include/linux/swapops.h, include/linux/leafops.h, mm/memcontrol.c,
mm/memory.c, mm/mmap.c, mm/page-writeback.c, mm/slub.c, and mm/sparse.h.
In preprocessor conditionals such as include/linux/mm_types_task.h and
mm/memcontrol.c, undefined PAGE_SIZE_MAX and PAGE_SHIFT_MAX also evaluate
to 0 (or fail under -Werror=undef).
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index d065b26a94dfa..5d60c15af51f4 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -1169,7 +1169,7 @@ static int __init setup_transparent_hugepage(char *str)
> }
> __setup("transparent_hugepage=", setup_transparent_hugepage);
>
> -static char str_dup[PAGE_SIZE] __initdata;
> +static char str_dup[SZ_4K] __initdata;
> static int __init setup_thp_anon(char *str)
> {
> char *token, *range, *policy, *subtoken;
> @@ -1178,7 +1178,7 @@ static int __init setup_thp_anon(char *str)
> int start, end, nr;
> char *p;
>
> - if (!str || strlen(str) + 1 > PAGE_SIZE)
> + if (!str || strlen(str) + 1 > SZ_4K)
> goto err;
> strscpy(str_dup, str);
[Severity: Medium]
Should the identical file-scope str_dup[PAGE_SIZE] buffer in
mm/shmem.c:setup_thp_shmem() also be converted to SZ_4K so mm/shmem.c does
not fail to compile with a variable-length array at file scope when
PAGE_SIZE is non-constant?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202031647.1690622-1-ericcurtin17@gmail.com?part=13
prev parent reply other threads:[~2026-12-03 3:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 3:16 [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:16 ` [RFC PATCH v2 13/13] mm: Use PAGE_SIZE_MIN/MAX where a compile-time constant is required Eric Curtin
2026-12-03 3:17 ` sashiko-bot [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=sashiko-outbox-247085@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=chrisl@kernel.org \
--cc=cl@gentwo.org \
--cc=dave.jiang@intel.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=djbw@kernel.org \
--cc=ericcurtin17@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=iweiny@kernel.org \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=kas@kernel.org \
--cc=kasong@tencent.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=linux-mtd@lists.infradead.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=miquel.raynal@bootlin.com \
--cc=mkoutny@suse.com \
--cc=muchun.song@linux.dev \
--cc=nico.pache@linux.dev \
--cc=nphamcs@gmail.com \
--cc=nvdimm@lists.linux.dev \
--cc=pfalcato@suse.de \
--cc=qi.zheng@linux.dev \
--cc=richard@nod.at \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shakeel.butt@linux.dev \
--cc=shikemeng@huaweicloud.com \
--cc=surenb@google.com \
--cc=tj@kernel.org \
--cc=urezki@gmail.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=vigneshr@ti.com \
--cc=vishal.l.verma@intel.com \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=youngjun.park@lge.com \
--cc=yuanchu@google.com \
--cc=ziy@nvidia.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