projects/linux·commit 5ce1a70e

Merge branch 'akpm' (more incoming from Andrew)

5ce1a70e · Linus Torvalds <[email protected]> · 2013-02-23 17:50:35 -08:00

Merge second patch-bomb from Andrew Morton:

 - A little DM fix

 - the MM queue

* emailed patches from Andrew Morton <[email protected]>: (154 commits)
  ksm: allocate roots when needed
  mm: cleanup "swapcache" in do_swap_page
  mm,ksm: swapoff might need to copy
  mm,ksm: FOLL_MIGRATION do migration_entry_wait
  ksm: shrink 32-bit rmap_item back to 32 bytes
  ksm: treat unstable nid like in stable tree
  ksm: add some comments
  tmpfs: fix mempolicy object leaks
  tmpfs: fix use-after-free of mempolicy object
  mm/fadvise.c: drain all pagevecs if POSIX_FADV_DONTNEED fails to discard all pages
  mm: export mmu notifier invalidates
  mm: accelerate mm_populate() treatment of THP pages
  mm: use long type for page counts in mm_populate() and get_user_pages()
  mm: accurately document nr_free_*_pages functions with code comments
  HWPOISON: change order of error_states[]'s elements
  HWPOISON: fix misjudgement of page_action() for errors on mlocked pages
  memcg: stop warning on memcg_propagate_kmem
  net: change type of virtio_chan->p9_max_pages
  vmscan: change type of vm_total_pages to unsigned long
  fs/nfsd: change type of max_delegations, nfsd_drc_max_mem and nfsd_drc_mem_used
  ...
Commit
5ce1a70e2f00f0bce0cab57f798ca354b9496169
Parents
9d3cae26 · ef53d16c

Merge commit. Changes below are compared with the first parent: 9d3cae26.

Changes

113 files changed · +4408 −1632

FileStatusAddDelContent
Documentation/ABI/testing/sysfs-kernel-mm-ksmadded+52−0View file
Documentation/kernel-parameters.txtmodified+36−0View file
Documentation/vm/ksm.txtmodified+15−0View file
arch/arm64/mm/mmu.cmodified+3−0View file
arch/ia64/mm/contig.cmodified+1−1View file
arch/ia64/mm/discontig.cmodified+5−1View file
arch/ia64/mm/init.cmodified+18−0View file
arch/powerpc/mm/init_64.cmodified+5−0View file
arch/powerpc/mm/mem.cmodified+12−0View file
arch/s390/mm/init.cmodified+12−0View file
arch/s390/mm/vmem.cmodified+4−0View file
arch/sh/mm/init.cmodified+17−0View file
arch/sparc/mm/init_32.cmodified+1−1View file
arch/sparc/mm/init_64.cmodified+5−0View file
arch/tile/mm/elf.cmodified+0−1View file
arch/tile/mm/init.cmodified+8−0View file
arch/tile/mm/pgtable.cmodified+1−1View file
arch/x86/include/asm/numa.hmodified+2−2View file
arch/x86/include/asm/pgtable_types.hmodified+1−0View file
arch/x86/kernel/acpi/boot.cmodified+4−0View file
arch/x86/kernel/setup.cmodified+9−4View file
arch/x86/mm/init_32.cmodified+12−0View file
arch/x86/mm/init_64.cmodified+397−0View file
arch/x86/mm/numa.cmodified+9−8View file
arch/x86/mm/pageattr.cmodified+25−22View file
arch/x86/mm/srat.cmodified+122−3View file
block/genhd.cmodified+10−0View file
drivers/acpi/acpi_memhotplug.cmodified+6−2View file
drivers/acpi/numa.cmodified+13−10View file
drivers/acpi/processor_driver.cmodified+2−0View file
drivers/base/memory.cmodified+6−0View file
drivers/base/power/runtime.cmodified+88−1View file
drivers/firmware/memmap.cmodified+183−13View file
drivers/md/persistent-data/dm-transaction-manager.cmodified+7−7View file
drivers/staging/zcache/zbud.cmodified+1−1View file
drivers/staging/zsmalloc/zsmalloc-main.cmodified+1−1View file
drivers/usb/core/hub.cmodified+13−0View file
fs/aio.cmodified+5−2View file
fs/buffer.cmodified+2−2View file
fs/nfsd/nfs4state.cmodified+3−3View file
fs/nfsd/nfsd.hmodified+3−3View file
fs/nfsd/nfssvc.cmodified+3−3View file
fs/proc/meminfo.cmodified+3−3View file
include/linux/acpi.hmodified+8−0View file
include/linux/bootmem.hmodified+1−0View file
include/linux/compaction.hmodified+2−3View file
include/linux/firmware-map.hmodified+6−0View file
include/linux/highmem.hmodified+0−6View file
include/linux/huge_mm.hmodified+1−1View file
include/linux/hugetlb.hmodified+3−3View file
include/linux/ksm.hmodified+4−14View file
include/linux/memblock.hmodified+2−0View file
include/linux/memcontrol.hmodified+0−7View file
include/linux/memory_hotplug.hmodified+12−8View file
include/linux/migrate.hmodified+6−8View file
include/linux/mm.hmodified+99−79View file
include/linux/mm_types.hmodified+5−4View file
include/linux/mman.hmodified+3−1View file
include/linux/mmzone.hmodified+33−25View file
include/linux/page-flags-layout.hadded+88−0View file
include/linux/page-isolation.hmodified+19−0View file
include/linux/pm.hmodified+1−0View file
include/linux/pm_runtime.hmodified+3−0View file
include/linux/rmap.hmodified+1−1View file
include/linux/sched.hmodified+22−0View file
include/linux/swap.hmodified+36−13View file
include/linux/vm_event_item.hmodified+0−1View file
include/linux/vmstat.hmodified+1−1View file
ipc/shm.cmodified+7−5View file
kernel/sched/core.cmodified+19−9View file
kernel/sysctl.cmodified+0−1View file
mm/Kconfigmodified+9−1View file
mm/compaction.cmodified+18−17View file
mm/fadvise.cmodified+16−2View file
mm/fremap.cmodified+27−24View file
mm/huge_memory.cmodified+24−71View file
mm/hugetlb.cmodified+15−19View file
mm/internal.hmodified+2−2View file
mm/kmemleak.cmodified+2−3View file
mm/ksm.cmodified+529−128View file
mm/madvise.cmodified+101−4View file
mm/memblock.cmodified+50−0View file
mm/memcontrol.cmodified+268−205View file
mm/memory-failure.cmodified+124−78View file
mm/memory.cmodified+68−57View file
mm/memory_hotplug.cmodified+494−59View file
mm/mempolicy.cmodified+32−27View file
mm/migrate.cmodified+68−96View file
mm/mincore.cmodified+3−2View file
mm/mlock.cmodified+30−71View file
mm/mm_init.cmodified+19−12View file
mm/mmap.cmodified+49−34View file
mm/mmu_notifier.cmodified+44−40View file
mm/mmzone.cmodified+19−1View file
mm/mremap.cmodified+14−13View file
mm/nommu.cmodified+17−11View file
mm/oom_kill.cmodified+4−2View file
mm/page-writeback.cmodified+3−0View file
mm/page_alloc.cmodified+371−68View file
mm/rmap.cmodified+3−3View file
mm/shmem.cmodified+30−18View file
mm/slob.cmodified+1−1View file
mm/slub.cmodified+1−1View file
mm/sparse.cmodified+8−4View file
mm/swap.cmodified+7−2View file
mm/swap_state.cmodified+40−18View file
mm/swapfile.cmodified+125−49View file
mm/util.cmodified+25−1View file
mm/vmalloc.cmodified+18−15View file
mm/vmscan.cmodified+213−184View file
mm/vmstat.cmodified+4−3View file
net/9p/trans_virtio.cmodified+1−1View file
net/core/net-sysfs.cmodified+5−0View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/ABI/testing/sysfs-kernel-mm-ksm

View file
diff --git a/Documentation/ABI/testing/sysfs-kernel-mm-ksm b/Documentation/ABI/testing/sysfs-kernel-mm-ksm
new file mode 100644
index 0000000..73e653e
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-kernel-mm-ksm
@@ -0,0 +1,52 @@
+What: /sys/kernel/mm/ksm
+Date: September 2009
+KernelVersion: 2.6.32
+Contact: Linux memory management mailing list <[email protected]>
+Description: Interface for Kernel Samepage Merging (KSM)
+
+What: /sys/kernel/mm/ksm/full_scans
+What: /sys/kernel/mm/ksm/pages_shared
+What: /sys/kernel/mm/ksm/pages_sharing
+What: /sys/kernel/mm/ksm/pages_to_scan
+What: /sys/kernel/mm/ksm/pages_unshared
+What: /sys/kernel/mm/ksm/pages_volatile
+What: /sys/kernel/mm/ksm/run
+What: /sys/kernel/mm/ksm/sleep_millisecs
+Date: September 2009
+Contact: Linux memory management mailing list <[email protected]>
+Description: Kernel Samepage Merging daemon sysfs interface
+
+ full_scans: how many times all mergeable areas have been
+ scanned.
+
+ pages_shared: how many shared pages are being used.
+
+ pages_sharing: how many more sites are sharing them i.e. how
+ much saved.
+
+ pages_to_scan: how many present pages to scan before ksmd goes
+ to sleep.
+
+ pages_unshared: how many pages unique but repeatedly checked
+ for merging.
+
+ pages_volatile: how many pages changing too fast to be placed
+ in a tree.
+
+ run: write 0 to disable ksm, read 0 while ksm is disabled.
+ write 1 to run ksm, read 1 while ksm is running.
+ write 2 to disable ksm and unmerge all its pages.
+
+ sleep_millisecs: how many milliseconds ksm should sleep between
+ scans.
+
+ See Documentation/vm/ksm.txt for more information.
+
+What: /sys/kernel/mm/ksm/merge_across_nodes
+Date: January 2013
+KernelVersion: 3.9
+Contact: Linux memory management mailing list <[email protected]>
+Description: Control merging pages across different NUMA nodes.
+
+ When it is set to 0 only pages from the same node are merged,
+ otherwise pages from all nodes can be merged together (default).

Documentation/kernel-parameters.txt

View file
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 9aa8ff3..7660877 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1640,6 +1640,42 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
that the amount of memory usable for all allocations
is not too small.
+ movablemem_map=acpi
+ [KNL,X86,IA-64,PPC] This parameter is similar to
+ memmap except it specifies the memory map of
+ ZONE_MOVABLE.
+ This option inform the kernel to use Hot Pluggable bit
+ in flags from SRAT from ACPI BIOS to determine which
+ memory devices could be hotplugged. The corresponding
+ memory ranges will be set as ZONE_MOVABLE.
+ NOTE: Whatever node the kernel resides in will always
+ be un-hotpluggable.
+
+ movablemem_map=nn[KMG]@ss[KMG]
+ [KNL,X86,IA-64,PPC] This parameter is similar to
+ memmap except it specifies the memory map of
+ ZONE_MOVABLE.
+ If user specifies memory ranges, the info in SRAT will
+ be ingored. And it works like the following:
+ - If more ranges are all within one node, then from
+ lowest ss to the end of the node will be ZONE_MOVABLE.
+ - If a range is within a node, then from ss to the end
+ of the node will be ZONE_MOVABLE.
+ - If a range covers two or more nodes, then from ss to
+ the end of the 1st node will be ZONE_MOVABLE, and all
+ the rest nodes will only have ZONE_MOVABLE.
+ If memmap is specified at the same time, the
+ movablemem_map will be limited within the memmap
+ areas. If kernelcore or movablecore is also specified,
+ movablemem_map will have higher priority to be
+ satisfied. So the administrator should be careful that
+ the amount of movablemem_map areas are not too large.
+ Otherwise kernel won't have enough memory to start.
+ NOTE: We don't stop users specifying the node the
+ kernel resides in as hotpluggable so that this
+ option can be used as a workaround of firmware
+ bugs.
+
MTD_Partition= [MTD]
Format: <name>,<region-number>,<size>,<offset>

Documentation/vm/ksm.txt

View file
diff --git a/Documentation/vm/ksm.txt b/Documentation/vm/ksm.txt
index b392e49..f34a8ee 100644
--- a/Documentation/vm/ksm.txt
+++ b/Documentation/vm/ksm.txt
@@ -58,6 +58,21 @@ sleep_millisecs - how many milliseconds ksmd should sleep before next scan
e.g. "echo 20 > /sys/kernel/mm/ksm/sleep_millisecs"
Default: 20 (chosen for demonstration purposes)
+merge_across_nodes - specifies if pages from different numa nodes can be merged.
+ When set to 0, ksm merges only pages which physically
+ reside in the memory area of same NUMA node. That brings
+ lower latency to access of shared pages. Systems with more
+ nodes, at significant NUMA distances, are likely to benefit
+ from the lower latency of setting 0. Smaller systems, which
+ need to minimize memory usage, are likely to benefit from
+ the greater sharing of setting 1 (default). You may wish to
+ compare how your system performs under each setting, before
+ deciding on which to use. merge_across_nodes setting can be
+ changed only when there are no ksm shared pages in system:
+ set run 2 to unmerge pages first, then to 1 after changing
+ merge_across_nodes, to remerge according to the new setting.
+ Default: 1 (merging across nodes as in earlier releases)
+
run - set 0 to stop ksmd from running but keep merged pages,
set 1 to run ksmd e.g. "echo 1 > /sys/kernel/mm/ksm/run",
set 2 to stop ksmd and unmerge all pages currently merged,

arch/arm64/mm/mmu.c

View file
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index f4dd585..224b44a 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -434,4 +434,7 @@ int __meminit vmemmap_populate(struct page *start_page,
return 0;
}
#endif /* CONFIG_ARM64_64K_PAGES */
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
#endif /* CONFIG_SPARSEMEM_VMEMMAP */

arch/ia64/mm/contig.c

View file
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 1516d1d..80dab50 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -93,7 +93,7 @@ void show_mem(unsigned int filter)
printk(KERN_INFO "%d pages swap cached\n", total_cached);
printk(KERN_INFO "Total of %ld pages in page table cache\n",
quicklist_total_size());
- printk(KERN_INFO "%d free buffer pages\n", nr_free_buffer_pages());
+ printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
}

arch/ia64/mm/discontig.c

View file
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index c641333..c2e955e 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -666,7 +666,7 @@ void show_mem(unsigned int filter)
printk(KERN_INFO "%d pages swap cached\n", total_cached);
printk(KERN_INFO "Total of %ld pages in page table cache\n",
quicklist_total_size());
- printk(KERN_INFO "%d free buffer pages\n", nr_free_buffer_pages());
+ printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
}
/**
@@ -822,4 +822,8 @@ int __meminit vmemmap_populate(struct page *start_page,
{
return vmemmap_populate_basepages(start_page, size, node);
}
+
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
#endif

arch/ia64/mm/init.c

View file
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b755ea9..20bc967 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -688,6 +688,24 @@ int arch_add_memory(int nid, u64 start, u64 size)
return ret;
}
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int arch_remove_memory(u64 start, u64 size)
+{
+ unsigned long start_pfn = start >> PAGE_SHIFT;
+ unsigned long nr_pages = size >> PAGE_SHIFT;
+ struct zone *zone;
+ int ret;
+
+ zone = page_zone(pfn_to_page(start_pfn));
+ ret = __remove_pages(zone, start_pfn, nr_pages);
+ if (ret)
+ pr_warn("%s: Problem encountered in __remove_pages() as"
+ " ret=%d\n", __func__, ret);
+
+ return ret;
+}
+#endif
#endif
/*

arch/powerpc/mm/init_64.c

View file
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 95a4529..7e2246f 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -297,5 +297,10 @@ int __meminit vmemmap_populate(struct page *start_page,
return 0;
}
+
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
+
#endif /* CONFIG_SPARSEMEM_VMEMMAP */

arch/powerpc/mm/mem.c

View file
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 40df7c8..f1f7409 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -133,6 +133,18 @@ int arch_add_memory(int nid, u64 start, u64 size)
return __add_pages(nid, zone, start_pfn, nr_pages);
}
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int arch_remove_memory(u64 start, u64 size)
+{
+ unsigned long start_pfn = start >> PAGE_SHIFT;
+ unsigned long nr_pages = size >> PAGE_SHIFT;
+ struct zone *zone;
+
+ zone = page_zone(pfn_to_page(start_pfn));
+ return __remove_pages(zone, start_pfn, nr_pages);
+}
+#endif
#endif /* CONFIG_MEMORY_HOTPLUG */
/*

arch/s390/mm/init.c

View file
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index ae672f4..49ce6bb 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -228,4 +228,16 @@ int arch_add_memory(int nid, u64 start, u64 size)
vmem_remove_mapping(start, size);
return rc;
}
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int arch_remove_memory(u64 start, u64 size)
+{
+ /*
+ * There is no hardware or firmware interface which could trigger a
+ * hot memory remove on s390. So there is nothing that needs to be
+ * implemented.
+ */
+ return -EBUSY;
+}
+#endif
#endif /* CONFIG_MEMORY_HOTPLUG */

arch/s390/mm/vmem.c

View file
diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
index 79699f4..e21aaf4 100644
--- a/arch/s390/mm/vmem.c
+++ b/arch/s390/mm/vmem.c
@@ -268,6 +268,10 @@ out:
return ret;
}
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
+
/*
* Add memory segment to the segment list if it doesn't overlap with
* an already present segment.

arch/sh/mm/init.c

View file
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index 82cc576..1057940 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -558,4 +558,21 @@ int memory_add_physaddr_to_nid(u64 addr)
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
#endif
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int arch_remove_memory(u64 start, u64 size)
+{
+ unsigned long start_pfn = start >> PAGE_SHIFT;
+ unsigned long nr_pages = size >> PAGE_SHIFT;
+ struct zone *zone;
+ int ret;
+
+ zone = page_zone(pfn_to_page(start_pfn));
+ ret = __remove_pages(zone, start_pfn, nr_pages);
+ if (unlikely(ret))
+ pr_warn("%s: Failed, __remove_pages() == %d\n", __func__,
+ ret);
+
+ return ret;
+}
+#endif
#endif /* CONFIG_MEMORY_HOTPLUG */

arch/sparc/mm/init_32.c

View file
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index dde85ef..48e0c03 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -57,7 +57,7 @@ void show_mem(unsigned int filter)
printk("Mem-info:\n");
show_free_areas(filter);
printk("Free swap: %6ldkB\n",
- nr_swap_pages << (PAGE_SHIFT-10));
+ get_nr_swap_pages() << (PAGE_SHIFT-10));
printk("%ld pages of RAM\n", totalram_pages);
printk("%ld free pages\n", nr_free_pages());
}

arch/sparc/mm/init_64.c

View file
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 5c2c6e6..1588d33 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2235,6 +2235,11 @@ void __meminit vmemmap_populate_print_last(void)
node_start = 0;
}
}
+
+void vmemmap_free(struct page *memmap, unsigned long nr_pages)
+{
+}
+
#endif /* CONFIG_SPARSEMEM_VMEMMAP */
static void prot_init_common(unsigned long page_none,

arch/tile/mm/elf.c

View file
diff --git a/arch/tile/mm/elf.c b/arch/tile/mm/elf.c
index 3cfa98b..743c951 100644
--- a/arch/tile/mm/elf.c
+++ b/arch/tile/mm/elf.c
@@ -130,7 +130,6 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
if (!retval) {
unsigned long addr = MEM_USER_INTRPT;
addr = mmap_region(NULL, addr, INTRPT_SIZE,
- MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE,
VM_READ|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC, 0);
if (addr > (unsigned long) -PAGE_SIZE)

arch/tile/mm/init.c

View file
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index ef29d6c..2749515 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -935,6 +935,14 @@ int remove_memory(u64 start, u64 size)
{
return -EINVAL;
}
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int arch_remove_memory(u64 start, u64 size)
+{
+ /* TODO */
+ return -EBUSY;
+}
+#endif
#endif
struct kmem_cache *pgd_cache;

arch/tile/mm/pgtable.c

View file
diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c
index de0de0c..b3b4972 100644
--- a/arch/tile/mm/pgtable.c
+++ b/arch/tile/mm/pgtable.c
@@ -61,7 +61,7 @@ void show_mem(unsigned int filter)
global_page_state(NR_PAGETABLE),
global_page_state(NR_BOUNCE),
global_page_state(NR_FILE_PAGES),
- nr_swap_pages);
+ get_nr_swap_pages());
for_each_zone(zone) {
unsigned long flags, order, total = 0, largest_order = -1;

arch/x86/include/asm/numa.h

View file
diff --git a/arch/x86/include/asm/numa.h b/arch/x86/include/asm/numa.h
index 52560a2..1b99ee5 100644
--- a/arch/x86/include/asm/numa.h
+++ b/arch/x86/include/asm/numa.h
@@ -57,8 +57,8 @@ static inline int numa_cpu_node(int cpu)
#endif
#ifdef CONFIG_NUMA
-extern void __cpuinit numa_set_node(int cpu, int node);
-extern void __cpuinit numa_clear_node(int cpu);
+extern void numa_set_node(int cpu, int node);
+extern void numa_clear_node(int cpu);
extern void __init init_cpu_to_node(void);
extern void __cpuinit numa_add_cpu(int cpu);
extern void __cpuinit numa_remove_cpu(int cpu);

arch/x86/include/asm/pgtable_types.h

View file
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index e642300..567b5d0 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -351,6 +351,7 @@ static inline void update_page_count(int level, unsigned long pages) { }
* as a pte too.
*/
extern pte_t *lookup_address(unsigned long address, unsigned int *level);
+extern int __split_large_page(pte_t *kpte, unsigned long address, pte_t *pbase);
extern phys_addr_t slow_virt_to_phys(void *__address);
#endif /* !__ASSEMBLY__ */

arch/x86/kernel/acpi/boot.c

View file
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index cfc755d..230c8ea 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -696,6 +696,10 @@ EXPORT_SYMBOL(acpi_map_lsapic);
int acpi_unmap_lsapic(int cpu)
{
+#ifdef CONFIG_ACPI_NUMA
+ set_apicid_to_node(per_cpu(x86_cpu_to_apicid, cpu), NUMA_NO_NODE);
+#endif
+
per_cpu(x86_cpu_to_apicid, cpu) = -1;
set_cpu_present(cpu, false);
num_processors--;

arch/x86/kernel/setup.c

View file
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 915f5ef..9c857f0 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1056,6 +1056,15 @@ void __init setup_arch(char **cmdline_p)
setup_bios_corruption_check();
#endif
+ /*
+ * In the memory hotplug case, the kernel needs info from SRAT to
+ * determine which memory is hotpluggable before allocating memory
+ * using memblock.
+ */
+ acpi_boot_table_init();
+ early_acpi_boot_init();
+ early_parse_srat();
+
#ifdef CONFIG_X86_32
printk(KERN_DEBUG "initial memory mapped: [mem 0x00000000-%#010lx]\n",
(max_pfn_mapped<<PAGE_SHIFT) - 1);
@@ -1101,10 +1110,6 @@ void __init setup_arch(char **cmdline_p)
/*
* Parse the ACPI tables for possible boot-time SMP configuration.
*/
- acpi_boot_table_init();
-
- early_acpi_boot_init();
-
initmem_init();
memblock_find_dma_reserve();

arch/x86/mm/init_32.c

View file
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index b299724..2d19001 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -862,6 +862,18 @@ int arch_add_memory(int nid, u64 start, u64 size)
return __add_pages(nid, zone, start_pfn, nr_pages);
}
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int arch_remove_memory(u64 start, u64 size)
+{
+ unsigned long start_pfn = start >> PAGE_SHIFT;
+ unsigned long nr_pages = size >> PAGE_SHIFT;
+ struct zone *zone;
+
+ zone = page_zone(pfn_to_page(start_pfn));
+ return __remove_pages(zone, start_pfn, nr_pages);
+}
+#endif
#endif
/*

arch/x86/mm/init_64.c

View file
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 3eba7f4..474e28f 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -707,6 +707,343 @@ int arch_add_memory(int nid, u64 start, u64 size)
}
EXPORT_SYMBOL_GPL(arch_add_memory);
+#define PAGE_INUSE 0xFD
+
+static void __meminit free_pagetable(struct page *page, int order)
+{
+ struct zone *zone;
+ bool bootmem = false;
+ unsigned long magic;
+ unsigned int nr_pages = 1 << order;
+
+ /* bootmem page has reserved flag */
+ if (PageReserved(page)) {
+ __ClearPageReserved(page);
+ bootmem = true;
+
+ magic = (unsigned long)page->lru.next;
+ if (magic == SECTION_INFO || magic == MIX_SECTION_INFO) {
+ while (nr_pages--)
+ put_page_bootmem(page++);
+ } else
+ __free_pages_bootmem(page, order);
+ } else
+ free_pages((unsigned long)page_address(page), order);
+
+ /*
+ * SECTION_INFO pages and MIX_SECTION_INFO pages
+ * are all allocated by bootmem.
+ */
+ if (bootmem) {
+ zone = page_zone(page);
+ zone_span_writelock(zone);
+ zone->present_pages += nr_pages;
+ zone_span_writeunlock(zone);
+ totalram_pages += nr_pages;
+ }
+}
+
+static void __meminit free_pte_table(pte_t *pte_start, pmd_t *pmd)
+{
+ pte_t *pte;
+ int i;
+
+ for (i = 0; i < PTRS_PER_PTE; i++) {
+ pte = pte_start + i;
+ if (pte_val(*pte))
+ return;
+ }
+
+ /* free a pte talbe */
+ free_pagetable(pmd_page(*pmd), 0);
+ spin_lock(&init_mm.page_table_lock);
+ pmd_clear(pmd);
+ spin_unlock(&init_mm.page_table_lock);
+}
+
+static void __meminit free_pmd_table(pmd_t *pmd_start, pud_t *pud)
+{
+ pmd_t *pmd;
+ int i;
+
+ for (i = 0; i < PTRS_PER_PMD; i++) {
+ pmd = pmd_start + i;
+ if (pmd_val(*pmd))
+ return;
+ }
+
+ /* free a pmd talbe */
+ free_pagetable(pud_page(*pud), 0);
+ spin_lock(&init_mm.page_table_lock);
+ pud_clear(pud);
+ spin_unlock(&init_mm.page_table_lock);
+}
+
+/* Return true if pgd is changed, otherwise return false. */
+static bool __meminit free_pud_table(pud_t *pud_start, pgd_t *pgd)
+{
+ pud_t *pud;
+ int i;
+
+ for (i = 0; i < PTRS_PER_PUD; i++) {
+ pud = pud_start + i;
+ if (pud_val(*pud))
+ return false;
+ }
+
+ /* free a pud table */
+ free_pagetable(pgd_page(*pgd), 0);
+ spin_lock(&init_mm.page_table_lock);
+ pgd_clear(pgd);
+ spin_unlock(&init_mm.page_table_lock);
+
+ return true;
+}
+
+static void __meminit
+remove_pte_table(pte_t *pte_start, unsigned long addr, unsigned long end,
+ bool direct)
+{
+ unsigned long next, pages = 0;
+ pte_t *pte;
+ void *page_addr;
+ phys_addr_t phys_addr;
+
+ pte = pte_start + pte_index(addr);
+ for (; addr < end; addr = next, pte++) {
+ next = (addr + PAGE_SIZE) & PAGE_MASK;
+ if (next > end)
+ next = end;
+
+ if (!pte_present(*pte))
+ continue;
+
+ /*
+ * We mapped [0,1G) memory as identity mapping when
+ * initializing, in arch/x86/kernel/head_64.S. These
+ * pagetables cannot be removed.
+ */

This diff is incomplete. Download the complete patch.

arch/x86/mm/numa.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/mm/pageattr.c

View file

This diff is incomplete. Download the complete patch.

arch/x86/mm/srat.c

View file

This diff is incomplete. Download the complete patch.

block/genhd.c

View file

This diff is incomplete. Download the complete patch.

drivers/acpi/acpi_memhotplug.c

View file

This diff is incomplete. Download the complete patch.

drivers/acpi/numa.c

View file

This diff is incomplete. Download the complete patch.

drivers/acpi/processor_driver.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/memory.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/power/runtime.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/memmap.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/persistent-data/dm-transaction-manager.c

View file

This diff is incomplete. Download the complete patch.

drivers/staging/zcache/zbud.c

View file

This diff is incomplete. Download the complete patch.

drivers/staging/zsmalloc/zsmalloc-main.c

View file

This diff is incomplete. Download the complete patch.

drivers/usb/core/hub.c

View file

This diff is incomplete. Download the complete patch.

fs/aio.c

View file

This diff is incomplete. Download the complete patch.

fs/buffer.c

View file

This diff is incomplete. Download the complete patch.

fs/nfsd/nfs4state.c

View file

This diff is incomplete. Download the complete patch.

fs/nfsd/nfsd.h

View file

This diff is incomplete. Download the complete patch.

fs/nfsd/nfssvc.c

View file

This diff is incomplete. Download the complete patch.

fs/proc/meminfo.c

View file

This diff is incomplete. Download the complete patch.

include/linux/acpi.h

View file

This diff is incomplete. Download the complete patch.

include/linux/bootmem.h

View file

This diff is incomplete. Download the complete patch.

include/linux/compaction.h

View file

This diff is incomplete. Download the complete patch.

include/linux/firmware-map.h

View file

This diff is incomplete. Download the complete patch.

include/linux/highmem.h

View file

This diff is incomplete. Download the complete patch.

include/linux/huge_mm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/hugetlb.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ksm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/memblock.h

View file

This diff is incomplete. Download the complete patch.

include/linux/memcontrol.h

View file

This diff is incomplete. Download the complete patch.

include/linux/memory_hotplug.h

View file

This diff is incomplete. Download the complete patch.

include/linux/migrate.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mm_types.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mman.h

View file

This diff is incomplete. Download the complete patch.

include/linux/mmzone.h

View file

This diff is incomplete. Download the complete patch.

include/linux/page-flags-layout.h

View file

This diff is incomplete. Download the complete patch.

include/linux/page-isolation.h

View file

This diff is incomplete. Download the complete patch.

include/linux/pm.h

View file

This diff is incomplete. Download the complete patch.

include/linux/pm_runtime.h

View file

This diff is incomplete. Download the complete patch.

include/linux/rmap.h

View file

This diff is incomplete. Download the complete patch.

include/linux/sched.h

View file

This diff is incomplete. Download the complete patch.

include/linux/swap.h

View file

This diff is incomplete. Download the complete patch.

include/linux/vm_event_item.h

View file

This diff is incomplete. Download the complete patch.

include/linux/vmstat.h

View file

This diff is incomplete. Download the complete patch.

ipc/shm.c

View file

This diff is incomplete. Download the complete patch.

kernel/sched/core.c

View file

This diff is incomplete. Download the complete patch.

kernel/sysctl.c

View file

This diff is incomplete. Download the complete patch.

mm/Kconfig

View file

This diff is incomplete. Download the complete patch.

mm/compaction.c

View file

This diff is incomplete. Download the complete patch.

mm/fadvise.c

View file

This diff is incomplete. Download the complete patch.

mm/fremap.c

View file

This diff is incomplete. Download the complete patch.

mm/huge_memory.c

View file

This diff is incomplete. Download the complete patch.

mm/hugetlb.c

View file

This diff is incomplete. Download the complete patch.

mm/internal.h

View file

This diff is incomplete. Download the complete patch.

mm/kmemleak.c

View file

This diff is incomplete. Download the complete patch.

mm/ksm.c

View file

This diff is incomplete. Download the complete patch.

mm/madvise.c

View file

This diff is incomplete. Download the complete patch.

mm/memblock.c

View file

This diff is incomplete. Download the complete patch.

mm/memcontrol.c

View file

This diff is incomplete. Download the complete patch.

mm/memory-failure.c

View file

This diff is incomplete. Download the complete patch.

mm/memory.c

View file

This diff is incomplete. Download the complete patch.

mm/memory_hotplug.c

View file

This diff is incomplete. Download the complete patch.

mm/mempolicy.c

View file

This diff is incomplete. Download the complete patch.

mm/migrate.c

View file

This diff is incomplete. Download the complete patch.

mm/mincore.c

View file

This diff is incomplete. Download the complete patch.

mm/mlock.c

View file

This diff is incomplete. Download the complete patch.

mm/mm_init.c

View file

This diff is incomplete. Download the complete patch.

mm/mmap.c

View file

This diff is incomplete. Download the complete patch.

mm/mmu_notifier.c

View file

This diff is incomplete. Download the complete patch.

mm/mmzone.c

View file

This diff is incomplete. Download the complete patch.

mm/mremap.c

View file

This diff is incomplete. Download the complete patch.

mm/nommu.c

View file

This diff is incomplete. Download the complete patch.

mm/oom_kill.c

View file

This diff is incomplete. Download the complete patch.

mm/page-writeback.c

View file

This diff is incomplete. Download the complete patch.

mm/page_alloc.c

View file

This diff is incomplete. Download the complete patch.

mm/rmap.c

View file

This diff is incomplete. Download the complete patch.

mm/shmem.c

View file

This diff is incomplete. Download the complete patch.

mm/slob.c

View file

This diff is incomplete. Download the complete patch.

mm/slub.c

View file

This diff is incomplete. Download the complete patch.

mm/sparse.c

View file

This diff is incomplete. Download the complete patch.

mm/swap.c

View file

This diff is incomplete. Download the complete patch.

mm/swap_state.c

View file

This diff is incomplete. Download the complete patch.

mm/swapfile.c

View file

This diff is incomplete. Download the complete patch.

mm/util.c

View file

This diff is incomplete. Download the complete patch.

mm/vmalloc.c

View file

This diff is incomplete. Download the complete patch.

mm/vmscan.c

View file

This diff is incomplete. Download the complete patch.

mm/vmstat.c

View file

This diff is incomplete. Download the complete patch.

net/9p/trans_virtio.c

View file

This diff is incomplete. Download the complete patch.

net/core/net-sysfs.c

View file

This diff is incomplete. Download the complete patch.