linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memblock: config the number of init memblock regions
@ 2022-05-11  1:05 Zhou Guanghui
  2022-05-11  1:55 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Zhou Guanghui @ 2022-05-11  1:05 UTC (permalink / raw)
  To: akpm, rppt; +Cc: linux-kernel, linux-mm, xuqiang36, zhouguanghui1

During early boot, the number of memblocks may exceed 128(some memory
areas are not reported to the kernel due to test failures. As a result,
contiguous memory is divided into multiple parts for reporting). If
the size of the init memblock regions is exceeded before the array size
can be resized, the excess memory will be lost.

Signed-off-by: Zhou Guanghui <zhouguanghui1@huawei.com>
---
 mm/Kconfig    | 8 ++++++++
 mm/memblock.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index 034d87953600..c6881802cccc 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -89,6 +89,14 @@ config SPARSEMEM_VMEMMAP
 	  pfn_to_page and page_to_pfn operations.  This is the most
 	  efficient option when sufficient kernel resources are available.
 
+config MEMBLOCK_INIT_REGIONS
+	int "Number of init memblock regions"
+	range 128 1024
+	default 128
+	help
+	  The number of init memblock regions which used to track "memory" and
+	  "reserved" memblocks during early boot.
+
 config HAVE_MEMBLOCK_PHYS_MAP
 	bool
 
diff --git a/mm/memblock.c b/mm/memblock.c
index e4f03a6e8e56..6893d26b750e 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -22,7 +22,7 @@
 
 #include "internal.h"
 
-#define INIT_MEMBLOCK_REGIONS			128
+#define INIT_MEMBLOCK_REGIONS			CONFIG_MEMBLOCK_INIT_REGIONS
 #define INIT_PHYSMEM_REGIONS			4
 
 #ifndef INIT_MEMBLOCK_RESERVED_REGIONS
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-25 17:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11  1:05 [PATCH] memblock: config the number of init memblock regions Zhou Guanghui
2022-05-11  1:55 ` Andrew Morton
2022-05-11  6:03   ` Mike Rapoport
2022-05-12  2:46     ` Zhouguanghui (OS Kernel)
2022-05-12  6:28       ` Mike Rapoport
2022-05-25 16:44         ` Darren Hart
2022-05-25 17:12           ` Mike Rapoport

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).