The patch titled ia64: remove empty nodes at boot time has been added to the -mm tree. Its filename is remove-empty-node-at-boot-time.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: ia64: remove empty nodes at boot time From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Remove empty nodes -- a node which containes no cpu, no memory (and no I/O). for ia64. This patch online nodes which has available resouces and avoid onlining nodes which has only possible resouces. SRAT describes possible resources, cpu and memory. It also shows proximity domain, pxm. Each numa node is created according to pxm. Current ia64 SRAT parser onlining node when new pxm is found. But sometimes pxm just includes 'possible' resources, doesn't includes available resources. Such pxms will create an empty node. When an empty node is onlined, it allocates a pgdat for an empty node. Now, fundamental codes for node-hot-plug are ready in -mm. We can add cpu and memory dynamically to the created new node. (memory-less-node hotplug is not ready. But I don't know whether there are demands for it now.) Then, we can remove empty nodes, which just includes possible resource. And, I'm now considering allocating new pgdat on-node. Empty nodes are obstacles to do that. TBD: I/O only node detections scheme should be fixed (if necessary). Does anyone have a suggestion ? Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: "Luck, Tony" <tony.luck@xxxxxxxxx> Cc: "Brown, Len" <len.brown@xxxxxxxxx> Cc: "Yu, Luming" <luming.yu@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/ia64/kernel/acpi.c | 60 ++++++++++++++++++++++++++++++------- arch/ia64/kernel/setup.c | 2 - arch/ia64/mm/contig.c | 2 - arch/ia64/mm/discontig.c | 2 - 4 files changed, 51 insertions(+), 15 deletions(-) diff -puN arch/ia64/kernel/acpi.c~remove-empty-node-at-boot-time arch/ia64/kernel/acpi.c --- 25/arch/ia64/kernel/acpi.c~remove-empty-node-at-boot-time Thu Jun 1 13:03:59 2006 +++ 25-akpm/arch/ia64/kernel/acpi.c Thu Jun 1 13:03:59 2006 @@ -515,6 +515,43 @@ acpi_numa_memory_affinity_init(struct ac num_node_memblks++; } +/* online node if node has valid memory */ +static +int find_valid_memory_range(unsigned long start, unsigned long end, void *arg) +{ + int i; + struct node_memblk_s *p; + start = __pa(start); + end = __pa(end); + for (i = 0; i < num_node_memblks; ++i) { + p = &node_memblk[i]; + if (end < p->start_paddr) + continue; + if (p->start_paddr + p->size <= start) + continue; + node_set_online(p->nid); + } + return 0; +} + +static void +acpi_online_node_fixup(void) +{ + int i, cpu; + /* online node if a node has available cpus */ + for (i = 0; i < srat_num_cpus; ++i) + for (cpu = 0; cpu < available_cpus; ++cpu) + if (smp_boot_data.cpu_phys_id[cpu] == + node_cpuid[i].phys_id) { + node_set_online(node_cpuid[i].nid); + break; + } + /* memory */ + efi_memmap_walk(find_valid_memory_range, NULL); + + /* TBD: check I/O devices which have valid nid. and online it*/ +} + void __init acpi_numa_arch_fixup(void) { int i, j, node_from, node_to; @@ -526,22 +563,28 @@ void __init acpi_numa_arch_fixup(void) return; } - /* - * MCD - This can probably be dropped now. No need for pxm ID to node ID - * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES. - */ nodes_clear(node_online_map); + /* MAP pxm to nid */ for (i = 0; i < MAX_PXM_DOMAINS; i++) { if (pxm_bit_test(i)) { - int nid = acpi_map_pxm_to_node(i); - node_set_online(nid); + /* this makes pxm <-> nid mapping */ + acpi_map_pxm_to_node(i); } } + /* convert pxm information to nid information */ - /* set logical node id in memory chunk structure */ for (i = 0; i < num_node_memblks; i++) node_memblk[i].nid = pxm_to_node(node_memblk[i].nid); + for (i = 0; i < srat_num_cpus; i++) + node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid); + + /* + * confirm node is online or not. + * onlined node will have their own NODE_DATA + */ + acpi_online_node_fixup(); + /* assign memory bank numbers for each chunk on each node */ for_each_online_node(i) { int bank; @@ -552,9 +595,6 @@ void __init acpi_numa_arch_fixup(void) node_memblk[j].bank = bank++; } - /* set logical node id in cpu structure */ - for (i = 0; i < srat_num_cpus; i++) - node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid); printk(KERN_INFO "Number of logical nodes in system = %d\n", num_online_nodes()); diff -puN arch/ia64/kernel/setup.c~remove-empty-node-at-boot-time arch/ia64/kernel/setup.c --- 25/arch/ia64/kernel/setup.c~remove-empty-node-at-boot-time Thu Jun 1 13:03:59 2006 +++ 25-akpm/arch/ia64/kernel/setup.c Thu Jun 1 13:03:59 2006 @@ -418,7 +418,7 @@ setup_arch (char **cmdline_p) if (early_console_setup(*cmdline_p) == 0) mark_bsp_online(); - + reserve_memory(); #ifdef CONFIG_ACPI /* Initialize the ACPI boot-time table parser */ acpi_table_init(); diff -puN arch/ia64/mm/contig.c~remove-empty-node-at-boot-time arch/ia64/mm/contig.c --- 25/arch/ia64/mm/contig.c~remove-empty-node-at-boot-time Thu Jun 1 13:03:59 2006 +++ 25-akpm/arch/ia64/mm/contig.c Thu Jun 1 13:03:59 2006 @@ -146,8 +146,6 @@ find_memory (void) { unsigned long bootmap_size; - reserve_memory(); - /* first find highest page frame number */ max_pfn = 0; efi_memmap_walk(find_max_pfn, &max_pfn); diff -puN arch/ia64/mm/discontig.c~remove-empty-node-at-boot-time arch/ia64/mm/discontig.c --- 25/arch/ia64/mm/discontig.c~remove-empty-node-at-boot-time Thu Jun 1 13:03:59 2006 +++ 25-akpm/arch/ia64/mm/discontig.c Thu Jun 1 13:03:59 2006 @@ -443,8 +443,6 @@ void __init find_memory(void) { int node; - reserve_memory(); - if (num_online_nodes() == 0) { printk(KERN_ERR "node info missing!\n"); node_set_online(0); _ Patches currently in -mm which might be from kamezawa.hiroyu@xxxxxxxxxxxxxx are for_each_possible_cpu-xfs.patch git-acpi.patch acpi-memory-hotplug-cannot-manage-_crs-with-plural-resoureces.patch remove-empty-node-at-boot-time.patch for_each_possible_cpu-mips.patch kconfigurable-resources-arch-dependent-changes-arch-a-i-fix.patch wait_table-and-zonelist-initializing-for-memory-hotadd-change-name-of-wait_table_size.patch wait_table-and-zonelist-initializing-for-memory-hotaddadd-return-code-for-init_current_empty_zone.patch wait_table-and-zonelist-initializing-for-memory-hotadd-wait_table-initialization.patch wait_table-and-zonelist-initializing-for-memory-hotadd-update-zonelists.patch support-for-panic-at-oom.patch pgdat-allocation-for-new-node-add-generic-alloc-node_data.patch pgdat-allocation-for-new-node-add-refresh-node_data.patch pgdat-allocation-for-new-node-add-export-kswapd-start-func.patch pgdat-allocation-for-new-node-add-call-pgdat-allocation.patch register-hot-added-memory-to-iomem-resource.patch catch-valid-mem-range-at-onlining-memory.patch node-hotplug-register-cpu-remove-node-struct.patch node-hotplug-register-cpu-remove-node-struct-alpha-fix.patch page-migration-simplify-migrate_pages.patch page-migration-simplify-migrate_pages-tweaks.patch page-migration-handle-freeing-of-pages-in-migrate_pages.patch page-migration-use-allocator-function-for-migrate_pages.patch page-migration-support-moving-of-individual-pages.patch page-migration-detailed-status-for-moving-of-individual-pages.patch genirq-rename-desc-handler-to-desc-chip-ia64-fix-2.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html