* [PATCH] mm: drop stale MAX_ORDER references
@ 2026-08-18 12:24 Qi Xi
2026-08-18 19:19 ` Zi Yan
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Qi Xi @ 2026-08-18 12:24 UTC (permalink / raw)
To: akpm, vbabka
Cc: longli, kotaranov, jan.kiszka, kbingham, surenb, mhocko,
brendan.jackman, hannes, ziy, linux-hyperv, linux-rdma, netdev,
linux-mm, linux-kernel, sunnanyong, wangkefeng.wang, xiqi2
The treewide rename in commit 5e0a760b4441 ("mm, treewide: rename
MAX_ORDER to MAX_PAGE_ORDER") left a few spots still using the old
name:
- two comments in include/net/mana/mana.h and mm/page_alloc.c;
- the gdb helper scripts/gdb/linux/mm.py, where self.MAX_ORDER is
a local mirror of the kernel's MAX_ORDER define.
Rename the leftover instances to MAX_PAGE_ORDER so the tree is
consistent.
No functional changes.
Signed-off-by: Qi Xi <xiqi2@huawei.com>
---
include/net/mana/mana.h | 4 ++--
mm/page_alloc.c | 2 +-
scripts/gdb/linux/mm.py | 8 ++++----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
index 04acb6791dbd..1d5bed71d6a7 100644
--- a/include/net/mana/mana.h
+++ b/include/net/mana/mana.h
@@ -40,8 +40,8 @@ enum TRI_STATE {
#define COMP_ENTRY_SIZE 64
/* This Max value for RX buffers is derived from __alloc_page()'s max page
- * allocation calculation. It allows maximum 2^(MAX_ORDER -1) pages. RX buffer
- * size beyond this value gets rejected by __alloc_page() call.
+ * allocation calculation. It allows maximum 2^(MAX_PAGE_ORDER -1) pages. RX
+ * buffer size beyond this value gets rejected by __alloc_page() call.
*/
#define MAX_RX_BUFFERS_PER_QUEUE 8192
#define DEF_RX_BUFFERS_PER_QUEUE 1024
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ee902a468c2f..42b5b41432c5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7803,7 +7803,7 @@ static bool cond_accept_memory(struct zone *zone, unsigned int order,
/*
* Watermarks have not been initialized yet.
*
- * Accepting one MAX_ORDER page to ensure progress.
+ * Accepting one MAX_PAGE_ORDER page to ensure progress.
*/
if (!wmark)
return try_to_accept_memory_one(zone);
diff --git a/scripts/gdb/linux/mm.py b/scripts/gdb/linux/mm.py
index dffadccbb01d..28d33624c38b 100644
--- a/scripts/gdb/linux/mm.py
+++ b/scripts/gdb/linux/mm.py
@@ -56,7 +56,7 @@ class x86_page_ops():
self.MAX_PHYSMEM_BITS = 46
self.SECTION_SIZE_BITS = 27
- self.MAX_ORDER = 10
+ self.MAX_PAGE_ORDER = 10
self.SECTIONS_SHIFT = self.MAX_PHYSMEM_BITS - self.SECTION_SIZE_BITS
self.NR_MEM_SECTIONS = 1 << self.SECTIONS_SHIFT
@@ -233,11 +233,11 @@ class aarch64_page_ops():
self.SECTIONS_SHIFT = self.MAX_PHYSMEM_BITS - self.SECTION_SIZE_BITS
if str(constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER).isdigit():
- self.MAX_ORDER = constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER
+ self.MAX_PAGE_ORDER = constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER
else:
- self.MAX_ORDER = 10
+ self.MAX_PAGE_ORDER = 10
- self.MAX_ORDER_NR_PAGES = 1 << (self.MAX_ORDER)
+ self.MAX_ORDER_NR_PAGES = 1 << (self.MAX_PAGE_ORDER)
self.PFN_SECTION_SHIFT = self.SECTION_SIZE_BITS - self.PAGE_SHIFT
self.NR_MEM_SECTIONS = 1 << self.SECTIONS_SHIFT
self.PAGES_PER_SECTION = 1 << self.PFN_SECTION_SHIFT
--
2.33.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: drop stale MAX_ORDER references
2026-08-18 12:24 [PATCH] mm: drop stale MAX_ORDER references Qi Xi
@ 2026-08-18 19:19 ` Zi Yan
2026-08-19 12:39 ` sashiko-bot
2026-08-20 13:27 ` Kiryl Shutsemau
2 siblings, 0 replies; 6+ messages in thread
From: Zi Yan @ 2026-08-18 19:19 UTC (permalink / raw)
To: Qi Xi, akpm, vbabka
Cc: longli, kotaranov, jan.kiszka, kbingham, surenb, mhocko,
brendan.jackman, hannes, linux-hyperv, linux-rdma, netdev,
linux-mm, linux-kernel, sunnanyong, wangkefeng.wang
On Tue Aug 18, 2026 at 8:24 AM EDT, Qi Xi wrote:
> The treewide rename in commit 5e0a760b4441 ("mm, treewide: rename
> MAX_ORDER to MAX_PAGE_ORDER") left a few spots still using the old
> name:
>
> - two comments in include/net/mana/mana.h and mm/page_alloc.c;
> - the gdb helper scripts/gdb/linux/mm.py, where self.MAX_ORDER is
> a local mirror of the kernel's MAX_ORDER define.
>
> Rename the leftover instances to MAX_PAGE_ORDER so the tree is
> consistent.
>
> No functional changes.
>
> Signed-off-by: Qi Xi <xiqi2@huawei.com>
> ---
> include/net/mana/mana.h | 4 ++--
> mm/page_alloc.c | 2 +-
> scripts/gdb/linux/mm.py | 8 ++++----
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
> index 04acb6791dbd..1d5bed71d6a7 100644
> --- a/include/net/mana/mana.h
> +++ b/include/net/mana/mana.h
> @@ -40,8 +40,8 @@ enum TRI_STATE {
> #define COMP_ENTRY_SIZE 64
>
> /* This Max value for RX buffers is derived from __alloc_page()'s max page
> - * allocation calculation. It allows maximum 2^(MAX_ORDER -1) pages. RX buffer
> - * size beyond this value gets rejected by __alloc_page() call.
> + * allocation calculation. It allows maximum 2^(MAX_PAGE_ORDER -1) pages. RX
It should be 2^MAX_PAGE_ORDER here, since MAX_PAGE_ORDER is inclusive
now.
> + * buffer size beyond this value gets rejected by __alloc_page() call.
> */
> #define MAX_RX_BUFFERS_PER_QUEUE 8192
> #define DEF_RX_BUFFERS_PER_QUEUE 1024
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ee902a468c2f..42b5b41432c5 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7803,7 +7803,7 @@ static bool cond_accept_memory(struct zone *zone, unsigned int order,
> /*
> * Watermarks have not been initialized yet.
> *
> - * Accepting one MAX_ORDER page to ensure progress.
> + * Accepting one MAX_PAGE_ORDER page to ensure progress.
> */
> if (!wmark)
> return try_to_accept_memory_one(zone);
> diff --git a/scripts/gdb/linux/mm.py b/scripts/gdb/linux/mm.py
> index dffadccbb01d..28d33624c38b 100644
> --- a/scripts/gdb/linux/mm.py
> +++ b/scripts/gdb/linux/mm.py
> @@ -56,7 +56,7 @@ class x86_page_ops():
>
> self.MAX_PHYSMEM_BITS = 46
> self.SECTION_SIZE_BITS = 27
> - self.MAX_ORDER = 10
> + self.MAX_PAGE_ORDER = 10
>
> self.SECTIONS_SHIFT = self.MAX_PHYSMEM_BITS - self.SECTION_SIZE_BITS
> self.NR_MEM_SECTIONS = 1 << self.SECTIONS_SHIFT
> @@ -233,11 +233,11 @@ class aarch64_page_ops():
> self.SECTIONS_SHIFT = self.MAX_PHYSMEM_BITS - self.SECTION_SIZE_BITS
>
> if str(constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER).isdigit():
> - self.MAX_ORDER = constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER
> + self.MAX_PAGE_ORDER = constants.LX_CONFIG_ARCH_FORCE_MAX_ORDER
> else:
> - self.MAX_ORDER = 10
> + self.MAX_PAGE_ORDER = 10
>
> - self.MAX_ORDER_NR_PAGES = 1 << (self.MAX_ORDER)
> + self.MAX_ORDER_NR_PAGES = 1 << (self.MAX_PAGE_ORDER)
> self.PFN_SECTION_SHIFT = self.SECTION_SIZE_BITS - self.PAGE_SHIFT
> self.NR_MEM_SECTIONS = 1 << self.SECTIONS_SHIFT
> self.PAGES_PER_SECTION = 1 << self.PFN_SECTION_SHIFT
The rest looks good to me.
With the comment in mana.h fixed, feel free to add
Reviewed-by: Zi Yan <ziy@nvidia.com>
--
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: drop stale MAX_ORDER references
2026-08-18 12:24 [PATCH] mm: drop stale MAX_ORDER references Qi Xi
2026-08-18 19:19 ` Zi Yan
@ 2026-08-19 12:39 ` sashiko-bot
2026-08-20 13:27 ` Kiryl Shutsemau
2 siblings, 0 replies; 6+ messages in thread
From: sashiko-bot @ 2026-08-19 12:39 UTC (permalink / raw)
To: Qi Xi; +Cc: linux-hyperv
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Blind text replacement in a comment causes the documented mathematical formula for maximum page allocation size to be halved.
--
--- Patch [1]: [PATCH] mm: drop stale MAX_ORDER references ---
commit dbb29499acbd8adcdd7b1a04573e7581c99841f4
Author: Qi Xi <xiqi2@huawei.com>
mm: drop stale MAX_ORDER references
This commit renames leftover instances of MAX_ORDER to MAX_PAGE_ORDER across
the tree, including comments and gdb helper scripts, to maintain consistency
after the treewide rename.
> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
> index 04acb6791dbd9..1d5bed71d6a7e 100644
> --- a/include/net/mana/mana.h
> +++ b/include/net/mana/mana.h
> @@ -40,8 +40,8 @@ enum TRI_STATE {
> #define COMP_ENTRY_SIZE 64
>
> /* This Max value for RX buffers is derived from __alloc_page()'s max page
> - * allocation calculation. It allows maximum 2^(MAX_ORDER -1) pages. RX buffer
> - * size beyond this value gets rejected by __alloc_page() call.
> + * allocation calculation. It allows maximum 2^(MAX_PAGE_ORDER -1) pages. RX
> + * buffer size beyond this value gets rejected by __alloc_page() call.
[Severity: Low]
Does this direct text replacement inadvertently halve the documented
maximum page allocation size?
The old formula used 2^(MAX_ORDER - 1). Because MAX_PAGE_ORDER is an
inclusive limit that is one less than the old exclusive MAX_ORDER, evaluating
2^(MAX_PAGE_ORDER - 1) results in half the actual maximum pages.
Should this formula be updated to just 2^MAX_PAGE_ORDER instead?
> */
> #define MAX_RX_BUFFERS_PER_QUEUE 8192
> #define DEF_RX_BUFFERS_PER_QUEUE 1024
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260818122408.4182417-1-xiqi2@huawei.com?part=1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: drop stale MAX_ORDER references
2026-08-18 12:24 [PATCH] mm: drop stale MAX_ORDER references Qi Xi
2026-08-18 19:19 ` Zi Yan
2026-08-19 12:39 ` sashiko-bot
@ 2026-08-20 13:27 ` Kiryl Shutsemau
2026-08-20 13:52 ` Zi Yan
2 siblings, 1 reply; 6+ messages in thread
From: Kiryl Shutsemau @ 2026-08-20 13:27 UTC (permalink / raw)
To: Qi Xi
Cc: akpm, vbabka, longli, kotaranov, jan.kiszka, kbingham, surenb,
mhocko, brendan.jackman, hannes, ziy, linux-hyperv, linux-rdma,
netdev, linux-mm, linux-kernel, sunnanyong, wangkefeng.wang
On Tue, Aug 18, 2026 at 08:24:08PM +0800, Qi Xi wrote:
> The treewide rename in commit 5e0a760b4441 ("mm, treewide: rename
> MAX_ORDER to MAX_PAGE_ORDER") left a few spots still using the old
> name:
>
> - two comments in include/net/mana/mana.h and mm/page_alloc.c;
> - the gdb helper scripts/gdb/linux/mm.py, where self.MAX_ORDER is
> a local mirror of the kernel's MAX_ORDER define.
>
> Rename the leftover instances to MAX_PAGE_ORDER so the tree is
> consistent.
>
> No functional changes.
>
> Signed-off-by: Qi Xi <xiqi2@huawei.com>
> ---
> include/net/mana/mana.h | 4 ++--
> mm/page_alloc.c | 2 +-
> scripts/gdb/linux/mm.py | 8 ++++----
> 3 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
> index 04acb6791dbd..1d5bed71d6a7 100644
> --- a/include/net/mana/mana.h
> +++ b/include/net/mana/mana.h
> @@ -40,8 +40,8 @@ enum TRI_STATE {
> #define COMP_ENTRY_SIZE 64
>
> /* This Max value for RX buffers is derived from __alloc_page()'s max page
> - * allocation calculation. It allows maximum 2^(MAX_ORDER -1) pages. RX buffer
> - * size beyond this value gets rejected by __alloc_page() call.
> + * allocation calculation. It allows maximum 2^(MAX_PAGE_ORDER -1) pages. RX
Should it reference MAX_ORDER_NR_PAGES instead?
> + * buffer size beyond this value gets rejected by __alloc_page() call.
> */
> #define MAX_RX_BUFFERS_PER_QUEUE 8192
> #define DEF_RX_BUFFERS_PER_QUEUE 1024
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: drop stale MAX_ORDER references
2026-08-20 13:27 ` Kiryl Shutsemau
@ 2026-08-20 13:52 ` Zi Yan
2026-08-20 15:00 ` Kiryl Shutsemau
0 siblings, 1 reply; 6+ messages in thread
From: Zi Yan @ 2026-08-20 13:52 UTC (permalink / raw)
To: Kiryl Shutsemau
Cc: Qi Xi, akpm, vbabka, longli, kotaranov, jan.kiszka, kbingham,
surenb, mhocko, brendan.jackman, hannes, linux-hyperv, linux-rdma,
netdev, linux-mm, linux-kernel, sunnanyong, wangkefeng.wang
On 20 Aug 2026, at 9:27, Kiryl Shutsemau wrote:
> On Tue, Aug 18, 2026 at 08:24:08PM +0800, Qi Xi wrote:
>> The treewide rename in commit 5e0a760b4441 ("mm, treewide: rename
>> MAX_ORDER to MAX_PAGE_ORDER") left a few spots still using the old
>> name:
>>
>> - two comments in include/net/mana/mana.h and mm/page_alloc.c;
>> - the gdb helper scripts/gdb/linux/mm.py, where self.MAX_ORDER is
>> a local mirror of the kernel's MAX_ORDER define.
>>
>> Rename the leftover instances to MAX_PAGE_ORDER so the tree is
>> consistent.
>>
>> No functional changes.
>>
>> Signed-off-by: Qi Xi <xiqi2@huawei.com>
>> ---
>> include/net/mana/mana.h | 4 ++--
>> mm/page_alloc.c | 2 +-
>> scripts/gdb/linux/mm.py | 8 ++++----
>> 3 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
>> index 04acb6791dbd..1d5bed71d6a7 100644
>> --- a/include/net/mana/mana.h
>> +++ b/include/net/mana/mana.h
>> @@ -40,8 +40,8 @@ enum TRI_STATE {
>> #define COMP_ENTRY_SIZE 64
>>
>> /* This Max value for RX buffers is derived from __alloc_page()'s max page
>> - * allocation calculation. It allows maximum 2^(MAX_ORDER -1) pages. RX buffer
>> - * size beyond this value gets rejected by __alloc_page() call.
>> + * allocation calculation. It allows maximum 2^(MAX_PAGE_ORDER -1) pages. RX
>
> Should it reference MAX_ORDER_NR_PAGES instead?
It is fixed in v2[1].
[1] https://lore.kernel.org/all/20260819082052.3338603-1-xiqi2@huawei.com/
>
>> + * buffer size beyond this value gets rejected by __alloc_page() call.
>> */
>> #define MAX_RX_BUFFERS_PER_QUEUE 8192
>> #define DEF_RX_BUFFERS_PER_QUEUE 1024
>
> --
> Kiryl Shutsemau / Kirill A. Shutemov
Best Regards,
Yan, Zi
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mm: drop stale MAX_ORDER references
2026-08-20 13:52 ` Zi Yan
@ 2026-08-20 15:00 ` Kiryl Shutsemau
0 siblings, 0 replies; 6+ messages in thread
From: Kiryl Shutsemau @ 2026-08-20 15:00 UTC (permalink / raw)
To: Zi Yan
Cc: Qi Xi, akpm, vbabka, longli, kotaranov, jan.kiszka, kbingham,
surenb, mhocko, brendan.jackman, hannes, linux-hyperv, linux-rdma,
netdev, linux-mm, linux-kernel, sunnanyong, wangkefeng.wang
On Thu, Aug 20, 2026 at 09:52:03AM -0400, Zi Yan wrote:
> On 20 Aug 2026, at 9:27, Kiryl Shutsemau wrote:
>
> > On Tue, Aug 18, 2026 at 08:24:08PM +0800, Qi Xi wrote:
> >> The treewide rename in commit 5e0a760b4441 ("mm, treewide: rename
> >> MAX_ORDER to MAX_PAGE_ORDER") left a few spots still using the old
> >> name:
> >>
> >> - two comments in include/net/mana/mana.h and mm/page_alloc.c;
> >> - the gdb helper scripts/gdb/linux/mm.py, where self.MAX_ORDER is
> >> a local mirror of the kernel's MAX_ORDER define.
> >>
> >> Rename the leftover instances to MAX_PAGE_ORDER so the tree is
> >> consistent.
> >>
> >> No functional changes.
> >>
> >> Signed-off-by: Qi Xi <xiqi2@huawei.com>
> >> ---
> >> include/net/mana/mana.h | 4 ++--
> >> mm/page_alloc.c | 2 +-
> >> scripts/gdb/linux/mm.py | 8 ++++----
> >> 3 files changed, 7 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/include/net/mana/mana.h b/include/net/mana/mana.h
> >> index 04acb6791dbd..1d5bed71d6a7 100644
> >> --- a/include/net/mana/mana.h
> >> +++ b/include/net/mana/mana.h
> >> @@ -40,8 +40,8 @@ enum TRI_STATE {
> >> #define COMP_ENTRY_SIZE 64
> >>
> >> /* This Max value for RX buffers is derived from __alloc_page()'s max page
> >> - * allocation calculation. It allows maximum 2^(MAX_ORDER -1) pages. RX buffer
> >> - * size beyond this value gets rejected by __alloc_page() call.
> >> + * allocation calculation. It allows maximum 2^(MAX_PAGE_ORDER -1) pages. RX
> >
> > Should it reference MAX_ORDER_NR_PAGES instead?
>
> It is fixed in v2[1].
It is not :)
My point is that 2^MAX_PAGE_ORDER is MAX_ORDER_NR_PAGES.
But v2 is good enough.
--
Kiryl Shutsemau / Kirill A. Shutemov
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-20 15:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 12:24 [PATCH] mm: drop stale MAX_ORDER references Qi Xi
2026-08-18 19:19 ` Zi Yan
2026-08-19 12:39 ` sashiko-bot
2026-08-20 13:27 ` Kiryl Shutsemau
2026-08-20 13:52 ` Zi Yan
2026-08-20 15:00 ` Kiryl Shutsemau
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox