From: Tejun Heo Date: Mon, 28 Nov 2011 17:46:22 +0000 (-0800) Subject: Merge branch 'master' into x86/memblock X-Git-Tag: v3.3-rc1~130^2~1 X-Git-Url: https://gentwo.org/gitweb/?a=commitdiff_plain;h=d4bbf7e7759afc172e2bfbc5c416324590049cdd;p=linux%2F.git Merge branch 'master' into x86/memblock Conflicts & resolutions: * arch/x86/xen/setup.c dc91c728fd "xen: allow extra memory to be in multiple regions" 24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..." conflicted on xen_add_extra_mem() updates. The resolution is trivial as the latter just want to replace memblock_x86_reserve_range() with memblock_reserve(). * drivers/pci/intel-iommu.c 166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/" 5dfe8660a3d "bootmem: Replace work_with_active_regions() with..." conflicted as the former moved the file under drivers/iommu/. Resolved by applying the chnages from the latter on the moved file. * mm/Kconfig 6661672053a "memblock: add NO_BOOTMEM config symbol" c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option" conflicted trivially. Both added config options. Just letting both add their own options resolves the conflict. * mm/memblock.c d1f0ece6cdc "mm/memblock.c: small function definition fixes" ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()" confliected. The former updates function removed by the latter. Resolution is trivial. Signed-off-by: Tejun Heo --- d4bbf7e7759afc172e2bfbc5c416324590049cdd diff --cc arch/x86/mm/init.c index 0b736b99d925,87488b93a65c..a298914058f9 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c @@@ -63,12 -63,11 +63,11 @@@ static void __init find_early_table_spa #ifdef CONFIG_X86_32 /* for fixmap */ tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE); - - good_end = max_pfn_mapped << PAGE_SHIFT; #endif + good_end = max_pfn_mapped << PAGE_SHIFT; base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE); - if (base == MEMBLOCK_ERROR) + if (!base) panic("Cannot find space for the kernel page tables"); pgt_buf_start = base >> PAGE_SHIFT; diff --cc arch/x86/xen/setup.c index 73daaf75801a,38d0af4fefec..f5e1362550e7 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@@ -50,26 -54,32 +54,32 @@@ unsigned long xen_released_pages */ #define EXTRA_MEM_RATIO (10) - static void __init xen_add_extra_mem(unsigned long pages) + static void __init xen_add_extra_mem(u64 start, u64 size) { unsigned long pfn; + int i; - u64 size = (u64)pages * PAGE_SIZE; - u64 extra_start = xen_extra_mem_start + xen_extra_mem_size; - - if (!pages) - return; - - e820_add_region(extra_start, size, E820_RAM); - sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); - - memblock_reserve(extra_start, size); + for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) { + /* Add new region. */ + if (xen_extra_mem[i].size == 0) { + xen_extra_mem[i].start = start; + xen_extra_mem[i].size = size; + break; + } + /* Append to existing region. */ + if (xen_extra_mem[i].start + xen_extra_mem[i].size == start) { + xen_extra_mem[i].size += size; + break; + } + } + if (i == XEN_EXTRA_MEM_MAX_REGIONS) + printk(KERN_WARNING "Warning: not enough extra memory regions\n"); - xen_extra_mem_size += size; - memblock_x86_reserve_range(start, start + size, "XEN EXTRA"); ++ memblock_reserve(start, size); - xen_max_p2m_pfn = PFN_DOWN(extra_start + size); + xen_max_p2m_pfn = PFN_DOWN(start + size); - for (pfn = PFN_DOWN(extra_start); pfn <= xen_max_p2m_pfn; pfn++) + for (pfn = PFN_DOWN(start); pfn <= xen_max_p2m_pfn; pfn++) __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); } diff --cc mm/Kconfig index 7c5697116fcf,011b110365c8..e338407f1225 --- a/mm/Kconfig +++ b/mm/Kconfig @@@ -131,12 -131,9 +131,15 @@@ config SPARSEMEM_VMEMMA config HAVE_MEMBLOCK boolean +config HAVE_MEMBLOCK_NODE_MAP + boolean + +config ARCH_DISCARD_MEMBLOCK + boolean + + config NO_BOOTMEM + boolean + # eventually, we can have this option just 'select SPARSEMEM' config MEMORY_HOTPLUG bool "Allow for memory hot-add"