[lkml]   [2019]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] mm/hotplug: Only respect mem= parameter during boot stage
In commit 357b4da50a62 ("x86: respect memory size limiting via mem=
parameter") a global varialbe global max_mem_size is added to store
the value which is parsed from 'mem= '. This truly stops those
DIMM from being added into system memory during boot.

However, it also limits the later memory hotplug functionality. Any
memory board can't be hot added any more if its region is beyond the
max_mem_size. System will print error like below:

[ 216.387164] acpi PNP0C80:02: add_memory failed
[ 216.389301] acpi PNP0C80:02: acpi_memory_enable_device() error
[ 216.392187] acpi PNP0C80:02: Enumeration failure

From document of 'mem =' parameter, it should be a restriction during
boot, but not impact the system memory adding/removing after booting.

mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory

So fix it by also checking if it's during SYSTEM_BOOTING stage when
restrict memory adding. Otherwise, skip the restriction.

Fixes: 357b4da50a62 ("x86: respect memory size limiting via mem= parameter")
Signed-off-by: Baoquan He <>
mm/memory_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 55ac23ef11c1..5466a0a00901 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -105,7 +105,7 @@ static struct resource *register_memory_resource(u64 start, u64 size)
char *resource_name = "System RAM";

- if (start + size > max_mem_size)
+ if (start + size > max_mem_size && system_state == SYSTEM_BOOTING)
return ERR_PTR(-E2BIG);

 \ /
  Last update: 2019-12-06 16:06    [W:0.116 / U:14.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site