Commit d8745178 authored by Andrew Donnellan's avatar Andrew Donnellan Committed by sanglipeng
Browse files

lib/test_meminit: allocate pages up to order MAX_ORDER

stable inclusion
from stable-v5.10.195
commit 2a1cf9fe09d94087bdf72566cc5c7f5808129ff9
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I95JOC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2a1cf9fe09d94087bdf72566cc5c7f5808129ff9

--------------------------------

commit efb78fa8 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: 5015a300 ("lib: introduce test_meminit module")
Signed-off-by: default avatarAndrew Donnellan <ajd@linux.ibm.com>
Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
Cc: Xiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent d4bff725
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment