summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Donnellan <ajd@linux.ibm.com>2023-07-14 04:52:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-09-23 11:59:57 +0300
commitcbfffe51221b46c1492393fe56c3bfaa0676375a (patch)
tree7583358f3a8ecac5ce6977d77a6d5e7f956db109 /lib
parent9b7f6e500969f53acf9ad748048f322aae8abbdc (diff)
downloadlinux-cbfffe51221b46c1492393fe56c3bfaa0676375a.tar.xz
lib/test_meminit: allocate pages up to order MAX_ORDER
commit efb78fa86e95832b78ca0ba60f3706788a818938 upstream. test_pages() tests the page allocator by calling alloc_pages() with different orders up to order 10. However, different architectures and platforms support different maximum contiguous allocation sizes. The default maximum allocation order (MAX_ORDER) is 10, but architectures can use CONFIG_ARCH_FORCE_MAX_ORDER to override this. On platforms where this is less than 10, test_meminit() will blow up with a WARN(). This is expected, so let's not do that. Replace the hardcoded "10" with the MAX_ORDER macro so that we test allocations up to the expected platform limit. Link: https://lkml.kernel.org/r/20230714015238.47931-1-ajd@linux.ibm.com Fixes: 5015a300a522 ("lib: introduce test_meminit module") Signed-off-by: Andrew Donnellan <ajd@linux.ibm.com> Reviewed-by: Alexander Potapenko <glider@google.com> Cc: Xiaoke Wang <xkernel.wang@foxmail.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/test_meminit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/test_meminit.c b/lib/test_meminit.c
index ab00c79423a5..2c6c96b40e3d 100644
--- a/lib/test_meminit.c
+++ b/lib/test_meminit.c
@@ -86,7 +86,7 @@ static int __init test_pages(int *total_failures)
int failures = 0, num_tests = 0;
int i;
- for (i = 0; i < 10; i++)
+ for (i = 0; i <= MAX_ORDER; i++)
num_tests += do_alloc_pages_order(i, &failures);
REPORT_FAILURES_IN_FN();