aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-04-29 14:21:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-04-29 14:21:22 -0400
commit1d003af2effbf10ef7b08736606dd306a29b3396 (patch)
tree1801e223f1ed61788df63be5f11702afdea457e5
parent92c19ea9535707701861b7533253a516c7d115c9 (diff)
parent7c88a292dfcd6979e839493ef18d04770eb3bad0 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge fixes from Andrew Morton: "20 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: Documentation/sysctl/vm.txt: update numa_zonelist_order description lib/stackdepot.c: allow the stack trace hash to be zero rapidio: fix potential NULL pointer dereference mm/memory-failure: fix race with compound page split/merge ocfs2/dlm: return zero if deref_done message is successfully handled Ananth has moved kcov: don't profile branches in kcov kcov: don't trace the code coverage code mm: wake kcompactd before kswapd's short sleep .mailmap: add Frank Rowand mm/hwpoison: fix wrong num_poisoned_pages accounting mm: call swap_slot_free_notify() with page lock held mm: vmscan: reclaim highmem zone if buffer_heads is over limit numa: fix /proc/<pid>/numa_maps for THP mm/huge_memory: replace VM_NO_THP VM_BUG_ON with actual VMA check mailmap: fix Krzysztof Kozlowski's misspelled name thp: keep huge zero page pinned until tlb flush mm: exclude HugeTLB pages from THP page_mapped() logic kexec: export OFFSET(page.compound_head) to find out compound tail page kexec: update VMCOREINFO for compound_order/dtor
-rw-r--r--.mailmap4
-rw-r--r--Documentation/sysctl/vm.txt19
-rw-r--r--MAINTAINERS2
-rw-r--r--drivers/rapidio/devices/rio_mport_cdev.c4
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c2
-rw-r--r--fs/proc/task_mmu.c33
-rw-r--r--include/linux/huge_mm.h5
-rw-r--r--include/linux/mm.h4
-rw-r--r--kernel/kcov.c3
-rw-r--r--kernel/kexec_core.c7
-rw-r--r--lib/stackdepot.c4
-rw-r--r--mm/huge_memory.c12
-rw-r--r--mm/memory-failure.c10
-rw-r--r--mm/memory.c40
-rw-r--r--mm/migrate.c8
-rw-r--r--mm/page_io.c6
-rw-r--r--mm/swap.c5
-rw-r--r--mm/vmscan.c30
18 files changed, 151 insertions, 47 deletions
diff --git a/.mailmap b/.mailmap
index 90c0aefc276d..c156a8b4d845 100644
--- a/.mailmap
+++ b/.mailmap
@@ -48,6 +48,9 @@ Felix Kuhling <fxkuehl@gmx.de>
48Felix Moeller <felix@derklecks.de> 48Felix Moeller <felix@derklecks.de>
49Filipe Lautert <filipe@icewall.org> 49Filipe Lautert <filipe@icewall.org>
50Franck Bui-Huu <vagabon.xyz@gmail.com> 50Franck Bui-Huu <vagabon.xyz@gmail.com>
51Frank Rowand <frowand.list@gmail.com> <frowand@mvista.com>
52Frank Rowand <frowand.list@gmail.com> <frank.rowand@am.sony.com>
53Frank Rowand <frowand.list@gmail.com> <frank.rowand@sonymobile.com>
51Frank Zago <fzago@systemfabricworks.com> 54Frank Zago <fzago@systemfabricworks.com>
52Greg Kroah-Hartman <greg@echidna.(none)> 55Greg Kroah-Hartman <greg@echidna.(none)>
53Greg Kroah-Hartman <gregkh@suse.de> 56Greg Kroah-Hartman <gregkh@suse.de>
@@ -79,6 +82,7 @@ Kay Sievers <kay.sievers@vrfy.org>
79Kenneth W Chen <kenneth.w.chen@intel.com> 82Kenneth W Chen <kenneth.w.chen@intel.com>
80Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> 83Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
81Koushik <raghavendra.koushik@neterion.com> 84Koushik <raghavendra.koushik@neterion.com>
85Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com>
82Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 86Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
83Leonid I Ananiev <leonid.i.ananiev@intel.com> 87Leonid I Ananiev <leonid.i.ananiev@intel.com>
84Linas Vepstas <linas@austin.ibm.com> 88Linas Vepstas <linas@austin.ibm.com>
diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
index cb0368459da3..34a5fece3121 100644
--- a/Documentation/sysctl/vm.txt
+++ b/Documentation/sysctl/vm.txt
@@ -581,15 +581,16 @@ Specify "[Nn]ode" for node order
581"Zone Order" orders the zonelists by zone type, then by node within each 581"Zone Order" orders the zonelists by zone type, then by node within each
582zone. Specify "[Zz]one" for zone order. 582zone. Specify "[Zz]one" for zone order.
583 583
584Specify "[Dd]efault" to request automatic configuration. Autoconfiguration 584Specify "[Dd]efault" to request automatic configuration.
585will select "node" order in following case. 585
586(1) if the DMA zone does not exist or 586On 32-bit, the Normal zone needs to be preserved for allocations accessible
587(2) if the DMA zone comprises greater than 50% of the available memory or 587by the kernel, so "zone" order will be selected.
588(3) if any node's DMA zone comprises greater than 70% of its local memory and 588
589 the amount of local memory is big enough. 589On 64-bit, devices that require DMA32/DMA are relatively rare, so "node"
590 590order will be selected.
591Otherwise, "zone" order will be selected. Default order is recommended unless 591
592this is causing problems for your system/application. 592Default order is recommended unless this is causing problems for your
593system/application.
593 594
594============================================================== 595==============================================================
595 596
diff --git a/MAINTAINERS b/MAINTAINERS
index 849133608da7..7f72d54f065d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6400,7 +6400,7 @@ F: mm/kmemleak.c
6400F: mm/kmemleak-test.c 6400F: mm/kmemleak-test.c
6401 6401
6402KPROBES 6402KPROBES
6403M: Ananth N Mavinakayanahalli <ananth@in.ibm.com> 6403M: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
6404M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> 6404M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
6405M: "David S. Miller" <davem@davemloft.net> 6405M: "David S. Miller" <davem@davemloft.net>
6406M: Masami Hiramatsu <mhiramat@kernel.org> 6406M: Masami Hiramatsu <mhiramat@kernel.org>
diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
index 5d4d91846357..96168b819044 100644
--- a/drivers/rapidio/devices/rio_mport_cdev.c
+++ b/drivers/rapidio/devices/rio_mport_cdev.c
@@ -2669,9 +2669,9 @@ static int __init mport_init(void)
2669 2669
2670 /* Create device class needed by udev */ 2670 /* Create device class needed by udev */
2671 dev_class = class_create(THIS_MODULE, DRV_NAME); 2671 dev_class = class_create(THIS_MODULE, DRV_NAME);
2672 if (!dev_class) { 2672 if (IS_ERR(dev_class)) {
2673 rmcd_error("Unable to create " DRV_NAME " class"); 2673 rmcd_error("Unable to create " DRV_NAME " class");
2674 return -EINVAL; 2674 return PTR_ERR(dev_class);
2675 } 2675 }
2676 2676
2677 ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME); 2677 ret = alloc_chrdev_region(&dev_number, 0, RIO_MAX_MPORTS, DRV_NAME);
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 9aed6e202201..13719d3f35f8 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -2455,6 +2455,8 @@ int dlm_deref_lockres_done_handler(struct o2net_msg *msg, u32 len, void *data,
2455 2455
2456 spin_unlock(&dlm->spinlock); 2456 spin_unlock(&dlm->spinlock);
2457 2457
2458 ret = 0;
2459
2458done: 2460done:
2459 dlm_put(dlm); 2461 dlm_put(dlm);
2460 return ret; 2462 return ret;
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 229cb546bee0..541583510cfb 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -1518,6 +1518,32 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma,
1518 return page; 1518 return page;
1519} 1519}
1520 1520
1521#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1522static struct page *can_gather_numa_stats_pmd(pmd_t pmd,
1523 struct vm_area_struct *vma,
1524 unsigned long addr)
1525{
1526 struct page *page;
1527 int nid;
1528
1529 if (!pmd_present(pmd))
1530 return NULL;
1531
1532 page = vm_normal_page_pmd(vma, addr, pmd);
1533 if (!page)
1534 return NULL;
1535
1536 if (PageReserved(page))
1537 return NULL;
1538
1539 nid = page_to_nid(page);
1540 if (!node_isset(nid, node_states[N_MEMORY]))
1541 return NULL;
1542
1543 return page;
1544}
1545#endif
1546
1521static int gather_pte_stats(pmd_t *pmd, unsigned long addr, 1547static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
1522 unsigned long end, struct mm_walk *walk) 1548 unsigned long end, struct mm_walk *walk)
1523{ 1549{
@@ -1527,14 +1553,14 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
1527 pte_t *orig_pte; 1553 pte_t *orig_pte;
1528 pte_t *pte; 1554 pte_t *pte;
1529 1555
1556#ifdef CONFIG_TRANSPARENT_HUGEPAGE
1530 ptl = pmd_trans_huge_lock(pmd, vma); 1557 ptl = pmd_trans_huge_lock(pmd, vma);
1531 if (ptl) { 1558 if (ptl) {
1532 pte_t huge_pte = *(pte_t *)pmd;
1533 struct page *page; 1559 struct page *page;
1534 1560
1535 page = can_gather_numa_stats(huge_pte, vma, addr); 1561 page = can_gather_numa_stats_pmd(*pmd, vma, addr);
1536 if (page) 1562 if (page)
1537 gather_stats(page, md, pte_dirty(huge_pte), 1563 gather_stats(page, md, pmd_dirty(*pmd),
1538 HPAGE_PMD_SIZE/PAGE_SIZE); 1564 HPAGE_PMD_SIZE/PAGE_SIZE);
1539 spin_unlock(ptl); 1565 spin_unlock(ptl);
1540 return 0; 1566 return 0;
@@ -1542,6 +1568,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
1542 1568
1543 if (pmd_trans_unstable(pmd)) 1569 if (pmd_trans_unstable(pmd))
1544 return 0; 1570 return 0;
1571#endif
1545 orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); 1572 orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
1546 do { 1573 do {
1547 struct page *page = can_gather_numa_stats(*pte, vma, addr); 1574 struct page *page = can_gather_numa_stats(*pte, vma, addr);
diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index 7008623e24b1..d7b9e5346fba 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -152,6 +152,7 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)
152} 152}
153 153
154struct page *get_huge_zero_page(void); 154struct page *get_huge_zero_page(void);
155void put_huge_zero_page(void);
155 156
156#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 157#else /* CONFIG_TRANSPARENT_HUGEPAGE */
157#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) 158#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
@@ -208,6 +209,10 @@ static inline bool is_huge_zero_page(struct page *page)
208 return false; 209 return false;
209} 210}
210 211
212static inline void put_huge_zero_page(void)
213{
214 BUILD_BUG();
215}
211 216
212static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma, 217static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma,
213 unsigned long addr, pmd_t *pmd, int flags) 218 unsigned long addr, pmd_t *pmd, int flags)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index a55e5be0894f..864d7221de84 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1031,6 +1031,8 @@ static inline bool page_mapped(struct page *page)
1031 page = compound_head(page); 1031 page = compound_head(page);
1032 if (atomic_read(compound_mapcount_ptr(page)) >= 0) 1032 if (atomic_read(compound_mapcount_ptr(page)) >= 0)
1033 return true; 1033 return true;
1034 if (PageHuge(page))
1035 return false;
1034 for (i = 0; i < hpage_nr_pages(page); i++) { 1036 for (i = 0; i < hpage_nr_pages(page); i++) {
1035 if (atomic_read(&page[i]._mapcount) >= 0) 1037 if (atomic_read(&page[i]._mapcount) >= 0)
1036 return true; 1038 return true;
@@ -1138,6 +1140,8 @@ struct zap_details {
1138 1140
1139struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, 1141struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
1140 pte_t pte); 1142 pte_t pte);
1143struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
1144 pmd_t pmd);
1141 1145
1142int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, 1146int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address,
1143 unsigned long size); 1147 unsigned long size);
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3efbee0834a8..a02f2dddd1d7 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -1,5 +1,6 @@
1#define pr_fmt(fmt) "kcov: " fmt 1#define pr_fmt(fmt) "kcov: " fmt
2 2
3#define DISABLE_BRANCH_PROFILING
3#include <linux/compiler.h> 4#include <linux/compiler.h>
4#include <linux/types.h> 5#include <linux/types.h>
5#include <linux/file.h> 6#include <linux/file.h>
@@ -43,7 +44,7 @@ struct kcov {
43 * Entry point from instrumented code. 44 * Entry point from instrumented code.
44 * This is called once per basic-block/edge. 45 * This is called once per basic-block/edge.
45 */ 46 */
46void __sanitizer_cov_trace_pc(void) 47void notrace __sanitizer_cov_trace_pc(void)
47{ 48{
48 struct task_struct *t; 49 struct task_struct *t;
49 enum kcov_mode mode; 50 enum kcov_mode mode;
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 8d34308ea449..1391d3ee3b86 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1415,6 +1415,9 @@ static int __init crash_save_vmcoreinfo_init(void)
1415 VMCOREINFO_OFFSET(page, lru); 1415 VMCOREINFO_OFFSET(page, lru);
1416 VMCOREINFO_OFFSET(page, _mapcount); 1416 VMCOREINFO_OFFSET(page, _mapcount);
1417 VMCOREINFO_OFFSET(page, private); 1417 VMCOREINFO_OFFSET(page, private);
1418 VMCOREINFO_OFFSET(page, compound_dtor);
1419 VMCOREINFO_OFFSET(page, compound_order);
1420 VMCOREINFO_OFFSET(page, compound_head);
1418 VMCOREINFO_OFFSET(pglist_data, node_zones); 1421 VMCOREINFO_OFFSET(pglist_data, node_zones);
1419 VMCOREINFO_OFFSET(pglist_data, nr_zones); 1422 VMCOREINFO_OFFSET(pglist_data, nr_zones);
1420#ifdef CONFIG_FLAT_NODE_MEM_MAP 1423#ifdef CONFIG_FLAT_NODE_MEM_MAP
@@ -1447,8 +1450,8 @@ static int __init crash_save_vmcoreinfo_init(void)
1447#ifdef CONFIG_X86 1450#ifdef CONFIG_X86
1448 VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE); 1451 VMCOREINFO_NUMBER(KERNEL_IMAGE_SIZE);
1449#endif 1452#endif
1450#ifdef CONFIG_HUGETLBFS 1453#ifdef CONFIG_HUGETLB_PAGE
1451 VMCOREINFO_SYMBOL(free_huge_page); 1454 VMCOREINFO_NUMBER(HUGETLB_PAGE_DTOR);
1452#endif 1455#endif
1453 1456
1454 arch_crash_save_vmcoreinfo(); 1457 arch_crash_save_vmcoreinfo();
diff --git a/lib/stackdepot.c b/lib/stackdepot.c
index 654c9d87e83a..9e0b0315a724 100644
--- a/lib/stackdepot.c
+++ b/lib/stackdepot.c
@@ -210,10 +210,6 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace,
210 goto fast_exit; 210 goto fast_exit;
211 211
212 hash = hash_stack(trace->entries, trace->nr_entries); 212 hash = hash_stack(trace->entries, trace->nr_entries);
213 /* Bad luck, we won't store this stack. */
214 if (hash == 0)
215 goto exit;
216
217 bucket = &stack_table[hash & STACK_HASH_MASK]; 213 bucket = &stack_table[hash & STACK_HASH_MASK];
218 214
219 /* 215 /*
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 86f9f8b82f8e..df67b53ae3c5 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -232,7 +232,7 @@ retry:
232 return READ_ONCE(huge_zero_page); 232 return READ_ONCE(huge_zero_page);
233} 233}
234 234
235static void put_huge_zero_page(void) 235void put_huge_zero_page(void)
236{ 236{
237 /* 237 /*
238 * Counter should never go to zero here. Only shrinker can put 238 * Counter should never go to zero here. Only shrinker can put
@@ -1684,12 +1684,12 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma,
1684 if (vma_is_dax(vma)) { 1684 if (vma_is_dax(vma)) {
1685 spin_unlock(ptl); 1685 spin_unlock(ptl);
1686 if (is_huge_zero_pmd(orig_pmd)) 1686 if (is_huge_zero_pmd(orig_pmd))
1687 put_huge_zero_page(); 1687 tlb_remove_page(tlb, pmd_page(orig_pmd));
1688 } else if (is_huge_zero_pmd(orig_pmd)) { 1688 } else if (is_huge_zero_pmd(orig_pmd)) {
1689 pte_free(tlb->mm, pgtable_trans_huge_withdraw(tlb->mm, pmd)); 1689 pte_free(tlb->mm, pgtable_trans_huge_withdraw(tlb->mm, pmd));
1690 atomic_long_dec(&tlb->mm->nr_ptes); 1690 atomic_long_dec(&tlb->mm->nr_ptes);
1691 spin_unlock(ptl); 1691 spin_unlock(ptl);
1692 put_huge_zero_page(); 1692 tlb_remove_page(tlb, pmd_page(orig_pmd));
1693 } else { 1693 } else {
1694 struct page *page = pmd_page(orig_pmd); 1694 struct page *page = pmd_page(orig_pmd);
1695 page_remove_rmap(page, true); 1695 page_remove_rmap(page, true);
@@ -1960,10 +1960,9 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma,
1960 * page fault if needed. 1960 * page fault if needed.
1961 */ 1961 */
1962 return 0; 1962 return 0;
1963 if (vma->vm_ops) 1963 if (vma->vm_ops || (vm_flags & VM_NO_THP))
1964 /* khugepaged not yet working on file or special mappings */ 1964 /* khugepaged not yet working on file or special mappings */
1965 return 0; 1965 return 0;
1966 VM_BUG_ON_VMA(vm_flags & VM_NO_THP, vma);
1967 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; 1966 hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK;
1968 hend = vma->vm_end & HPAGE_PMD_MASK; 1967 hend = vma->vm_end & HPAGE_PMD_MASK;
1969 if (hstart < hend) 1968 if (hstart < hend)
@@ -2352,8 +2351,7 @@ static bool hugepage_vma_check(struct vm_area_struct *vma)
2352 return false; 2351 return false;
2353 if (is_vma_temporary_stack(vma)) 2352 if (is_vma_temporary_stack(vma))
2354 return false; 2353 return false;
2355 VM_BUG_ON_VMA(vma->vm_flags & VM_NO_THP, vma); 2354 return !(vma->vm_flags & VM_NO_THP);
2356 return true;
2357} 2355}
2358 2356
2359static void collapse_huge_page(struct mm_struct *mm, 2357static void collapse_huge_page(struct mm_struct *mm,
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 78f5f2641b91..ca5acee53b7a 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page)
888 } 888 }
889 } 889 }
890 890
891 return get_page_unless_zero(head); 891 if (get_page_unless_zero(head)) {
892 if (head == compound_head(page))
893 return 1;
894
895 pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
896 put_page(head);
897 }
898
899 return 0;
892} 900}
893EXPORT_SYMBOL_GPL(get_hwpoison_page); 901EXPORT_SYMBOL_GPL(get_hwpoison_page);
894 902
diff --git a/mm/memory.c b/mm/memory.c
index 93897f23cc11..305537fc8640 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -789,6 +789,46 @@ out:
789 return pfn_to_page(pfn); 789 return pfn_to_page(pfn);
790} 790}
791 791
792#ifdef CONFIG_TRANSPARENT_HUGEPAGE
793struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
794 pmd_t pmd)
795{
796 unsigned long pfn = pmd_pfn(pmd);
797
798 /*
799 * There is no pmd_special() but there may be special pmds, e.g.
800 * in a direct-access (dax) mapping, so let's just replicate the
801 * !HAVE_PTE_SPECIAL case from vm_normal_page() here.
802 */
803 if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
804 if (vma->vm_flags & VM_MIXEDMAP) {
805 if (!pfn_valid(pfn))
806 return NULL;
807 goto out;
808 } else {
809 unsigned long off;
810 off = (addr - vma->vm_start) >> PAGE_SHIFT;
811 if (pfn == vma->vm_pgoff + off)
812 return NULL;
813 if (!is_cow_mapping(vma->vm_flags))
814 return NULL;
815 }
816 }
817
818 if (is_zero_pfn(pfn))
819 return NULL;
820 if (unlikely(pfn > highest_memmap_pfn))
821 return NULL;
822
823 /*
824 * NOTE! We still have PageReserved() pages in the page tables.
825 * eg. VDSO mappings can cause them to exist.
826 */
827out:
828 return pfn_to_page(pfn);
829}
830#endif
831
792/* 832/*
793 * copy one vm_area from one task to the other. Assumes the page tables 833 * copy one vm_area from one task to the other. Assumes the page tables
794 * already present in the new task to be cleared in the whole range 834 * already present in the new task to be cleared in the whole range
diff --git a/mm/migrate.c b/mm/migrate.c
index 6c822a7b27e0..f9dfb18a4eba 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -975,7 +975,13 @@ out:
975 dec_zone_page_state(page, NR_ISOLATED_ANON + 975 dec_zone_page_state(page, NR_ISOLATED_ANON +
976 page_is_file_cache(page)); 976 page_is_file_cache(page));
977 /* Soft-offlined page shouldn't go through lru cache list */ 977 /* Soft-offlined page shouldn't go through lru cache list */
978 if (reason == MR_MEMORY_FAILURE) { 978 if (reason == MR_MEMORY_FAILURE && rc == MIGRATEPAGE_SUCCESS) {
979 /*
980 * With this release, we free successfully migrated
981 * page and set PG_HWPoison on just freed page
982 * intentionally. Although it's rather weird, it's how
983 * HWPoison flag works at the moment.
984 */
979 put_page(page); 985 put_page(page);
980 if (!test_set_page_hwpoison(page)) 986 if (!test_set_page_hwpoison(page))
981 num_poisoned_pages_inc(); 987 num_poisoned_pages_inc();
diff --git a/mm/page_io.c b/mm/page_io.c
index cd92e3d67a32..985f23cfa79b 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -353,7 +353,11 @@ int swap_readpage(struct page *page)
353 353
354 ret = bdev_read_page(sis->bdev, swap_page_sector(page), page); 354 ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
355 if (!ret) { 355 if (!ret) {
356 swap_slot_free_notify(page); 356 if (trylock_page(page)) {
357 swap_slot_free_notify(page);
358 unlock_page(page);
359 }
360
357 count_vm_event(PSWPIN); 361 count_vm_event(PSWPIN);
358 return 0; 362 return 0;
359 } 363 }
diff --git a/mm/swap.c b/mm/swap.c
index a0bc206b4ac6..03aacbcb013f 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -728,6 +728,11 @@ void release_pages(struct page **pages, int nr, bool cold)
728 zone = NULL; 728 zone = NULL;
729 } 729 }
730 730
731 if (is_huge_zero_page(page)) {
732 put_huge_zero_page();
733 continue;
734 }
735
731 page = compound_head(page); 736 page = compound_head(page);
732 if (!put_page_testzero(page)) 737 if (!put_page_testzero(page))
733 continue; 738 continue;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b934223eaa45..142cb61f4822 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2553,7 +2553,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc)
2553 sc->gfp_mask |= __GFP_HIGHMEM; 2553 sc->gfp_mask |= __GFP_HIGHMEM;
2554 2554
2555 for_each_zone_zonelist_nodemask(zone, z, zonelist, 2555 for_each_zone_zonelist_nodemask(zone, z, zonelist,
2556 requested_highidx, sc->nodemask) { 2556 gfp_zone(sc->gfp_mask), sc->nodemask) {
2557 enum zone_type classzone_idx; 2557 enum zone_type classzone_idx;
2558 2558
2559 if (!populated_zone(zone)) 2559 if (!populated_zone(zone))
@@ -3318,6 +3318,20 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order,
3318 /* Try to sleep for a short interval */ 3318 /* Try to sleep for a short interval */
3319 if (prepare_kswapd_sleep(pgdat, order, remaining, 3319 if (prepare_kswapd_sleep(pgdat, order, remaining,
3320 balanced_classzone_idx)) { 3320 balanced_classzone_idx)) {
3321 /*
3322 * Compaction records what page blocks it recently failed to
3323 * isolate pages from and skips them in the future scanning.
3324 * When kswapd is going to sleep, it is reasonable to assume
3325 * that pages and compaction may succeed so reset the cache.
3326 */
3327 reset_isolation_suitable(pgdat);
3328
3329 /*
3330 * We have freed the memory, now we should compact it to make
3331 * allocation of the requested order possible.
3332 */
3333 wakeup_kcompactd(pgdat, order, classzone_idx);
3334
3321 remaining = schedule_timeout(HZ/10); 3335 remaining = schedule_timeout(HZ/10);
3322 finish_wait(&pgdat->kswapd_wait, &wait); 3336 finish_wait(&pgdat->kswapd_wait, &wait);
3323 prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE); 3337 prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE);
@@ -3341,20 +3355,6 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int order,
3341 */ 3355 */
3342 set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold); 3356 set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold);
3343 3357
3344 /*
3345 * Compaction records what page blocks it recently failed to
3346 * isolate pages from and skips them in the future scanning.
3347 * When kswapd is going to sleep, it is reasonable to assume
3348 * that pages and compaction may succeed so reset the cache.
3349 */
3350 reset_isolation_suitable(pgdat);
3351
3352 /*
3353 * We have freed the memory, now we should compact it to make
3354 * allocation of the requested order possible.
3355 */
3356 wakeup_kcompactd(pgdat, order, classzone_idx);
3357
3358 if (!kthread_should_stop()) 3358 if (!kthread_should_stop())
3359 schedule(); 3359 schedule();
3360 3360