Skip to content

Commit 5e0a760

Browse files
kirylakpm00
authored andcommitted
mm, treewide: rename MAX_ORDER to MAX_PAGE_ORDER
commit 23baf83 ("mm, treewide: redefine MAX_ORDER sanely") has changed the definition of MAX_ORDER to be inclusive. This has caused issues with code that was not yet upstream and depended on the previous definition. To draw attention to the altered meaning of the define, rename MAX_ORDER to MAX_PAGE_ORDER. Link: https://lkml.kernel.org/r/20231228144704.14033-2-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent fd37721 commit 5e0a760

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+186
-181
lines changed

Documentation/admin-guide/kdump/vmcoreinfo.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ from this.
193193
--------------------------------
194194

195195
Free areas descriptor. User-space tools use this value to iterate the
196-
free_area ranges. MAX_ORDER is used by the zone buddy allocator.
196+
free_area ranges. NR_PAGE_ORDERS is used by the zone buddy allocator.
197197

198198
prb
199199
---

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -970,17 +970,17 @@
970970
buddy allocator. Bigger value increase the probability
971971
of catching random memory corruption, but reduce the
972972
amount of memory for normal system use. The maximum
973-
possible value is MAX_ORDER/2. Setting this parameter
974-
to 1 or 2 should be enough to identify most random
975-
memory corruption problems caused by bugs in kernel or
976-
driver code when a CPU writes to (or reads from) a
977-
random memory location. Note that there exists a class
978-
of memory corruptions problems caused by buggy H/W or
979-
F/W or by drivers badly programming DMA (basically when
980-
memory is written at bus level and the CPU MMU is
981-
bypassed) which are not detectable by
982-
CONFIG_DEBUG_PAGEALLOC, hence this option will not help
983-
tracking down these problems.
973+
possible value is MAX_PAGE_ORDER/2. Setting this
974+
parameter to 1 or 2 should be enough to identify most
975+
random memory corruption problems caused by bugs in
976+
kernel or driver code when a CPU writes to (or reads
977+
from) a random memory location. Note that there exists
978+
a class of memory corruptions problems caused by buggy
979+
H/W or F/W or by drivers badly programming DMA
980+
(basically when memory is written at bus level and the
981+
CPU MMU is bypassed) which are not detectable by
982+
CONFIG_DEBUG_PAGEALLOC, hence this option will not
983+
help tracking down these problems.
984984

985985
debug_pagealloc=
986986
[KNL] When CONFIG_DEBUG_PAGEALLOC is set, this parameter
@@ -4136,7 +4136,7 @@
41364136
[KNL] Minimal page reporting order
41374137
Format: <integer>
41384138
Adjust the minimal page reporting order. The page
4139-
reporting is disabled when it exceeds MAX_ORDER.
4139+
reporting is disabled when it exceeds MAX_PAGE_ORDER.
41404140

41414141
panic= [KNL] Kernel behaviour on panic: delay <timeout>
41424142
timeout > 0: seconds before rebooting

Documentation/networking/packet_mmap.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,20 +263,20 @@ the name indicates, this function allocates pages of memory, and the second
263263
argument is "order" or a power of two number of pages, that is
264264
(for PAGE_SIZE == 4096) order=0 ==> 4096 bytes, order=1 ==> 8192 bytes,
265265
order=2 ==> 16384 bytes, etc. The maximum size of a
266-
region allocated by __get_free_pages is determined by the MAX_ORDER macro. More
267-
precisely the limit can be calculated as::
266+
region allocated by __get_free_pages is determined by the MAX_PAGE_ORDER macro.
267+
More precisely the limit can be calculated as::
268268

269-
PAGE_SIZE << MAX_ORDER
269+
PAGE_SIZE << MAX_PAGE_ORDER
270270

271271
In a i386 architecture PAGE_SIZE is 4096 bytes
272-
In a 2.4/i386 kernel MAX_ORDER is 10
273-
In a 2.6/i386 kernel MAX_ORDER is 11
272+
In a 2.4/i386 kernel MAX_PAGE_ORDER is 10
273+
In a 2.6/i386 kernel MAX_PAGE_ORDER is 11
274274

275275
So get_free_pages can allocate as much as 4MB or 8MB in a 2.4/2.6 kernel
276276
respectively, with an i386 architecture.
277277

278278
User space programs can include /usr/include/sys/user.h and
279-
/usr/include/linux/mmzone.h to get PAGE_SIZE MAX_ORDER declarations.
279+
/usr/include/linux/mmzone.h to get PAGE_SIZE MAX_PAGE_ORDER declarations.
280280

281281
The pagesize can also be determined dynamically with the getpagesize (2)
282282
system call.
@@ -324,7 +324,7 @@ Definitions:
324324
(see /proc/slabinfo)
325325
<pointer size> depends on the architecture -- ``sizeof(void *)``
326326
<page size> depends on the architecture -- PAGE_SIZE or getpagesize (2)
327-
<max-order> is the value defined with MAX_ORDER
327+
<max-order> is the value defined with MAX_PAGE_ORDER
328328
<frame size> it's an upper bound of frame's capture size (more on this later)
329329
============== ================================================================
330330

arch/arm/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ config ARCH_FORCE_MAX_ORDER
13621362
default "10"
13631363
help
13641364
The kernel page allocator limits the size of maximal physically
1365-
contiguous allocations. The limit is called MAX_ORDER and it
1365+
contiguous allocations. The limit is called MAX_PAGE_ORDER and it
13661366
defines the maximal power of two of number of pages that can be
13671367
allocated as a single contiguous block. This option allows
13681368
overriding the default setting when ability to allocate very

arch/arm64/Kconfig

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,32 +1520,32 @@ config XEN
15201520

15211521
# include/linux/mmzone.h requires the following to be true:
15221522
#
1523-
# MAX_ORDER + PAGE_SHIFT <= SECTION_SIZE_BITS
1523+
# MAX_PAGE_ORDER + PAGE_SHIFT <= SECTION_SIZE_BITS
15241524
#
1525-
# so the maximum value of MAX_ORDER is SECTION_SIZE_BITS - PAGE_SHIFT:
1525+
# so the maximum value of MAX_PAGE_ORDER is SECTION_SIZE_BITS - PAGE_SHIFT:
15261526
#
1527-
# | SECTION_SIZE_BITS | PAGE_SHIFT | max MAX_ORDER | default MAX_ORDER |
1528-
# ----+-------------------+--------------+-----------------+--------------------+
1529-
# 4K | 27 | 12 | 15 | 10 |
1530-
# 16K | 27 | 14 | 13 | 11 |
1531-
# 64K | 29 | 16 | 13 | 13 |
1527+
# | SECTION_SIZE_BITS | PAGE_SHIFT | max MAX_PAGE_ORDER | default MAX_PAGE_ORDER |
1528+
# ----+-------------------+--------------+----------------------+-------------------------+
1529+
# 4K | 27 | 12 | 15 | 10 |
1530+
# 16K | 27 | 14 | 13 | 11 |
1531+
# 64K | 29 | 16 | 13 | 13 |
15321532
config ARCH_FORCE_MAX_ORDER
15331533
int
15341534
default "13" if ARM64_64K_PAGES
15351535
default "11" if ARM64_16K_PAGES
15361536
default "10"
15371537
help
15381538
The kernel page allocator limits the size of maximal physically
1539-
contiguous allocations. The limit is called MAX_ORDER and it
1539+
contiguous allocations. The limit is called MAX_PAGE_ORDER and it
15401540
defines the maximal power of two of number of pages that can be
15411541
allocated as a single contiguous block. This option allows
15421542
overriding the default setting when ability to allocate very
15431543
large blocks of physically contiguous memory is required.
15441544

15451545
The maximal size of allocation cannot exceed the size of the
1546-
section, so the value of MAX_ORDER should satisfy
1546+
section, so the value of MAX_PAGE_ORDER should satisfy
15471547

1548-
MAX_ORDER + PAGE_SHIFT <= SECTION_SIZE_BITS
1548+
MAX_PAGE_ORDER + PAGE_SHIFT <= SECTION_SIZE_BITS
15491549

15501550
Don't change if unsure.
15511551

arch/arm64/include/asm/sparsemem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/*
1111
* Section size must be at least 512MB for 64K base
1212
* page size config. Otherwise it will be less than
13-
* MAX_ORDER and the build process will fail.
13+
* MAX_PAGE_ORDER and the build process will fail.
1414
*/
1515
#ifdef CONFIG_ARM64_64K_PAGES
1616
#define SECTION_SIZE_BITS 29

arch/arm64/kvm/hyp/nvhe/page_alloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ int hyp_pool_init(struct hyp_pool *pool, u64 pfn, unsigned int nr_pages,
228228
int i;
229229

230230
hyp_spin_lock_init(&pool->lock);
231-
pool->max_order = min(MAX_ORDER, get_order(nr_pages << PAGE_SHIFT));
231+
pool->max_order = min(MAX_PAGE_ORDER,
232+
get_order(nr_pages << PAGE_SHIFT));
232233
for (i = 0; i <= pool->max_order; i++)
233234
INIT_LIST_HEAD(&pool->free_area[i]);
234235
pool->range_start = phys;

arch/arm64/mm/hugetlbpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void __init arm64_hugetlb_cma_reserve(void)
5151
* page allocator. Just warn if there is any change
5252
* breaking this assumption.
5353
*/
54-
WARN_ON(order <= MAX_ORDER);
54+
WARN_ON(order <= MAX_PAGE_ORDER);
5555
hugetlb_cma_reserve(order);
5656
}
5757
#endif /* CONFIG_CMA */

arch/m68k/Kconfig.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ config ARCH_FORCE_MAX_ORDER
402402
default "10"
403403
help
404404
The kernel page allocator limits the size of maximal physically
405-
contiguous allocations. The limit is called MAX_ORDER and it
405+
contiguous allocations. The limit is called MAX_PAGE_ORDER and it
406406
defines the maximal power of two of number of pages that can be
407407
allocated as a single contiguous block. This option allows
408408
overriding the default setting when ability to allocate very

arch/nios2/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ config ARCH_FORCE_MAX_ORDER
5050
default "10"
5151
help
5252
The kernel page allocator limits the size of maximal physically
53-
contiguous allocations. The limit is called MAX_ORDER and it
53+
contiguous allocations. The limit is called MAX_PAGE_ORDER and it
5454
defines the maximal power of two of number of pages that can be
5555
allocated as a single contiguous block. This option allows
5656
overriding the default setting when ability to allocate very

0 commit comments

Comments
 (0)