Skip to contentSkip to conversation

acpi-numa-mem_hotplug-mark-all-nodes-the-kernel-resides-un-hotpluggable.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 22, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Subject: [merged] acpi-numa-mem_hotplug-mark-all-nodes-the-kernel-resides-un-hotpluggable.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 22 Jan 2014 12:13:08 -0800

The patch titled
Subject: acpi, numa, mem_hotplug: mark all nodes the kernel resides un-hotpluggable
has been removed from the -mm tree. Its filename was
acpi-numa-mem_hotplug-mark-all-nodes-the-kernel-resides-un-hotpluggable.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Tang Chen <[email protected]>
Subject: acpi, numa, mem_hotplug: mark all nodes the kernel resides un-hotpluggable

At very early time, the kernel have to use some memory such as loading the kernel image. We cannot prevent this anyway. So any node the kernel resides in should be un-hotpluggable.

Cc "H. Peter Anvin" <[email protected]>
Cc "Rafael J . Wysocki" <[email protected]>
Cc Chen Tang <[email protected]>
Cc Gong Chen <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiang Liu <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Lai Jiangshan <[email protected]>
Cc Larry Woodman <[email protected]>
Cc Len Brown <[email protected]>
Cc Liu Jiang <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Michal Nazarewicz <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Prarit Bhargava <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Taku Izumi <[email protected]>
Cc Tejun Heo <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Thomas Renninger <[email protected]>
Cc Toshi Kani <[email protected]>
Cc Vasilis Liaskovitis <[email protected]>
Cc Wanpeng Li <[email protected]>
Cc Wen Congyang <[email protected]>
Cc Yasuaki Ishimatsu <[email protected]>
Cc Yinghai Lu <[email protected]>

---

 arch/x86/mm/numa.c |   44 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/x86/mm/numa.c renamed from arch/x86/mm/numa.c~acpi-numa-mem_hotplug-mark-all-nodes-the-kernel-resides-un-hotpluggable +44 -0
diff -puN arch/x86/mm/numa.c~acpi-numa-mem_hotplug-mark-all-nodes-the-kernel-resides-un-hotpluggable arch/x86/mm/numa.c
@@ -493,6 +493,14 @@ static int __init numa_register_memblks(
 		struct numa_memblk *mb = &mi->blk[i];
 		memblock_set_node(mb->start, mb->end - mb->start,
 				  &memblock.memory, mb->nid);
+
+		/*
+		 * At this time, all memory regions reserved by memblock are
+		 * used by the kernel. Set the nid in memblock.reserved will
+		 * mark out all the nodes the kernel resides in.
+		 */
+		memblock_set_node(mb->start, mb->end - mb->start,
+				  &memblock.reserved, mb->nid);
 	}
 
 	/*
@@ -554,6 +562,30 @@ static void __init numa_init_array(void)
 	}
 }
 
+static void __init numa_clear_kernel_node_hotplug(void)
+{
+	int i, nid;
+	nodemask_t numa_kernel_nodes;
+	unsigned long start, end;
+	struct memblock_type *type = &memblock.reserved;
+
+	/* Mark all kernel nodes. */
+	for (i = 0; i < type->cnt; i++)
+		node_set(type->regions[i].nid, numa_kernel_nodes);
+
+	/* Clear MEMBLOCK_HOTPLUG flag for memory in kernel nodes. */
+	for (i = 0; i < numa_meminfo.nr_blks; i++) {
+		nid = numa_meminfo.blk[i].nid;
+		if (!node_isset(nid, numa_kernel_nodes))
+			continue;
+
+		start = numa_meminfo.blk[i].start;
+		end = numa_meminfo.blk[i].end;
+
+		memblock_clear_hotplug(start, end - start);
+	}
+}
+
 static int __init numa_init(int (*init_func)(void))
 {
 	int i;
@@ -568,6 +600,8 @@ static int __init numa_init(int (*init_f
 	memset(&numa_meminfo, 0, sizeof(numa_meminfo));
 	WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.memory,
 				  MAX_NUMNODES));
+	WARN_ON(memblock_set_node(0, ULLONG_MAX, &memblock.reserved,
+				  MAX_NUMNODES));
 	/* In case that parsing SRAT failed. */
 	WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX));
 	numa_reset_distance();
@@ -605,6 +639,16 @@ static int __init numa_init(int (*init_f
 			numa_clear_node(i);
 	}
 	numa_init_array();
+
+	/*
+	 * At very early time, the kernel have to use some memory such as
+	 * loading the kernel image. We cannot prevent this anyway. So any
+	 * node the kernel resides in should be un-hotpluggable.
+	 *
+	 * And when we come here, numa_init() won't fail.
+	 */
+	numa_clear_kernel_node_hotplug();
+
 	return 0;
 }
 

_

Patches currently in -mm which might be from [email protected] are

origin.patch mm-nobootmemc-add-return-value-check-in-__alloc_memory_core_early.patch mm-free-memblockmemory-in-free_all_bootmem.patch mm-free-memblockmemory-in-free_all_bootmem-fix.patch mm-nobootmem-free_all_bootmem-again.patch mm-memory_hotplugc-move-register_memory_resource-out-of-the-lock_memory_hotplug.patch linux-next.patch