|
@@ -478,6 +478,42 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void __init numa_clear_kernel_node_hotplug(void)
|
|
|
|
+{
|
|
|
|
+ int i, nid;
|
|
|
|
+ nodemask_t numa_kernel_nodes = NODE_MASK_NONE;
|
|
|
|
+ unsigned long start, end;
|
|
|
|
+ struct memblock_region *r;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 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.
|
|
|
|
+ */
|
|
|
|
+ for (i = 0; i < numa_meminfo.nr_blks; i++) {
|
|
|
|
+ struct numa_memblk *mb = &numa_meminfo.blk[i];
|
|
|
|
+
|
|
|
|
+ memblock_set_node(mb->start, mb->end - mb->start,
|
|
|
|
+ &memblock.reserved, mb->nid);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* Mark all kernel nodes. */
|
|
|
|
+ for_each_memblock(reserved, r)
|
|
|
|
+ node_set(r->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_register_memblks(struct numa_meminfo *mi)
|
|
static int __init numa_register_memblks(struct numa_meminfo *mi)
|
|
{
|
|
{
|
|
unsigned long uninitialized_var(pfn_align);
|
|
unsigned long uninitialized_var(pfn_align);
|
|
@@ -495,6 +531,15 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
|
|
&memblock.memory, mb->nid);
|
|
&memblock.memory, mb->nid);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * 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, alloc node data won't fail.
|
|
|
|
+ */
|
|
|
|
+ numa_clear_kernel_node_hotplug();
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* If sections array is gonna be used for pfn -> nid mapping, check
|
|
* If sections array is gonna be used for pfn -> nid mapping, check
|
|
* whether its granularity is fine enough.
|
|
* whether its granularity is fine enough.
|
|
@@ -554,41 +599,6 @@ static void __init numa_init_array(void)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-static void __init numa_clear_kernel_node_hotplug(void)
|
|
|
|
-{
|
|
|
|
- int i, nid;
|
|
|
|
- nodemask_t numa_kernel_nodes = NODE_MASK_NONE;
|
|
|
|
- unsigned long start, end;
|
|
|
|
- struct memblock_region *r;
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 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.
|
|
|
|
- */
|
|
|
|
- for (i = 0; i < numa_meminfo.nr_blks; i++) {
|
|
|
|
- struct numa_memblk *mb = &numa_meminfo.blk[i];
|
|
|
|
- memblock_set_node(mb->start, mb->end - mb->start,
|
|
|
|
- &memblock.reserved, mb->nid);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /* Mark all kernel nodes. */
|
|
|
|
- for_each_memblock(reserved, r)
|
|
|
|
- node_set(r->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))
|
|
static int __init numa_init(int (*init_func)(void))
|
|
{
|
|
{
|
|
int i;
|
|
int i;
|
|
@@ -643,15 +653,6 @@ static int __init numa_init(int (*init_func)(void))
|
|
}
|
|
}
|
|
numa_init_array();
|
|
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;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|