The patch titled vmemmap: simplify initialisation code and reduce duplication has been removed from the -mm tree. Its filename was generic-virtual-memmap-support-for-sparsemem-simplify-initialisation-code-and-reduce-duplication.patch This patch was dropped because it was folded into generic-virtual-memmap-support-for-sparsemem.patch ------------------------------------------------------ Subject: vmemmap: simplify initialisation code and reduce duplication From: Andy Whitcroft <apw@xxxxxxxxxxxx> The vmemmap and non-vmemmap implementations of sparse_early_mem_map_alloc() share a fair amount of code. Refactor this into a common wrapper, pulling the differences out to sparse_early_mem_map_populate(). This reduces depandancies between SPARSMEM and SPARSEMEM_VMEMMAP simplifying separation. Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx> Cc: Christoph Lameter <clameter@xxxxxxx> Cc: Dave Hansen <haveblue@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/sparse.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff -puN mm/sparse.c~generic-virtual-memmap-support-for-sparsemem-simplify-initialisation-code-and-reduce-duplication mm/sparse.c --- a/mm/sparse.c~generic-virtual-memmap-support-for-sparsemem-simplify-initialisation-code-and-reduce-duplication +++ a/mm/sparse.c @@ -387,33 +387,23 @@ int __meminit vmemmap_populate(struct pa } #endif /* !CONFIG_ARCH_POPULATES_SPARSEMEM_VMEMMAP */ -static struct page * __init sparse_early_mem_map_alloc(unsigned long pnum) +static struct page __init *sparse_early_mem_map_populate(unsigned long pnum, + int nid) { - struct page *map; - struct mem_section *ms = __nr_to_section(pnum); - int nid = sparse_early_nid(ms); - int error; - - map = pfn_to_page(pnum * PAGES_PER_SECTION); - error = vmemmap_populate(map, PAGES_PER_SECTION, nid); - if (error) { - printk(KERN_ERR "%s: allocation failed. Error=%d\n", - __FUNCTION__, error); - printk(KERN_ERR "%s: virtual memory map backing failed " - "some memory will not be available.\n", __FUNCTION__); - ms->section_mem_map = 0; + struct page *map = pfn_to_page(pnum * PAGES_PER_SECTION); + int error = vmemmap_populate(map, PAGES_PER_SECTION, nid); + if (error) return NULL; - } + return map; } #else /* CONFIG_SPARSEMEM_VMEMMAP */ -static struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) +static struct page __init *sparse_early_mem_map_populate(unsigned long pnum, + int nid) { struct page *map; - struct mem_section *ms = __nr_to_section(pnum); - int nid = sparse_early_nid(ms); map = alloc_remap(nid, sizeof(struct page) * PAGES_PER_SECTION); if (map) @@ -426,14 +416,25 @@ static struct page __init *sparse_early_ map = alloc_bootmem_node(NODE_DATA(nid), sizeof(struct page) * PAGES_PER_SECTION); + return map; +} +#endif /* !CONFIG_SPARSEMEM_VMEMMAP */ + +struct page __init *sparse_early_mem_map_alloc(unsigned long pnum) +{ + struct page *map; + struct mem_section *ms = __nr_to_section(pnum); + int nid = sparse_early_nid(ms); + + map = sparse_early_mem_map_populate(pnum, nid); if (map) return map; - printk(KERN_WARNING "%s: allocation failed\n", __FUNCTION__); + printk(KERN_ERR "%s: sparsemem memory map backing failed " + "some memory will not be available.\n", __FUNCTION__); ms->section_mem_map = 0; return NULL; } -#endif /* !CONFIG_SPARSEMEM_VMEMMAP */ /* * Allocate the accumulated non-linear sections, allocate a mem_map _ Patches currently in -mm which might be from apw@xxxxxxxxxxxx are sparsemem-clean-up-spelling-error-in-comments.patch sparsemem-record-when-a-section-has-a-valid-mem_map.patch generic-virtual-memmap-support-for-sparsemem.patch generic-virtual-memmap-support-for-sparsemem-simplify-initialisation-code-and-reduce-duplication.patch generic-virtual-memmap-support-for-sparsemem-pull-out-the-vmemmap-code-into-its-own-file.patch generic-virtual-memmap-support-vmemmap-generify-initialisation-via-helpers.patch x86_64-sparsemem_vmemmap-2m-page-size-support.patch x86_64-sparsemem_vmemmap-2m-page-size-support-ensure-end-of-section-memmap-is-initialised.patch x86_64-sparsemem_vmemmap-vmemmap-x86_64-convert-to-new-helper-based-initialisation.patch ia64-sparsemem_vmemmap-16k-page-size-support.patch ia64-sparsemem_vmemmap-16k-page-size-support-convert-to-new-helper-based-initialisation.patch sparc64-sparsemem_vmemmap-support.patch sparc64-sparsemem_vmemmap-support-vmemmap-convert-to-new-config-options.patch ppc64-sparsemem_vmemmap-support.patch ppc64-sparsemem_vmemmap-support-vmemmap-ppc64-convert-vmm_-macros-to-a-real-function.patch ppc64-sparsemem_vmemmap-support-vmemmap-ppc64-convert-vmm_-macros-to-a-real-function-fix.patch ppc64-sparsemem_vmemmap-support-convert-to-new-config-options.patch update-n_high_memory-node-state-for-memory-hotadd-fix.patch add-a-bitmap-that-is-used-to-track-flags-affecting-a-block-of-pages.patch add-a-configure-option-to-group-pages-by-mobility.patch move-free-pages-between-lists-on-steal.patch group-short-lived-and-reclaimable-kernel-allocations.patch do-not-group-pages-by-mobility-type-on-low-memory-systems.patch fix-corruption-of-memmap-on-ia64-sparsemem-when-mem_section-is-not-a-power-of-2.patch fix-corruption-of-memmap-on-ia64-sparsemem-when-mem_section-is-not-a-power-of-2-fix.patch bias-the-location-of-pages-freed-for-min_free_kbytes-in-the-same-max_order_nr_pages-blocks.patch remove-page_group_by_mobility.patch dont-group-high-order-atomic-allocations.patch fix-calculation-in-move_freepages_block-for-counting-pages.patch do-not-depend-on-max_order-when-grouping-pages-by-mobility.patch print-out-statistics-in-relation-to-fragmentation-avoidance-to-proc-pagetypeinfo.patch breakout-page_order-to-internalh-to-avoid-special-knowledge-of-the-buddy-allocator.patch memory-hotplug-hot-add-with-sparsemem-vmemmap.patch memory-hotplug-hot-add-with-sparsemem-vmemmap-update.patch hugetlb-move-update_and_free_page.patch hugetlb-try-to-grow-hugetlb-pool-for-map_private-mappings.patch hugetlb-try-to-grow-hugetlb-pool-for-map_shared-mappings.patch hugetlb-add-hugetlb_dynamic_pool-sysctl.patch update-checkpatchpl-to-version-010.patch printk-add-kern_cont-annotation.patch page-owner-tracking-leak-detector.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