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
Unified · Split
| @@ -48,6 +48,9 @@ Felix Kuhling <fxkuehl@gmx.de> · 47 unmodified lines | |||
| 48 | Felix Moeller <felix@derklecks.de> | 48 | Felix Moeller <felix@derklecks.de> |
| 49 | Filipe Lautert <filipe@icewall.org> | 49 | Filipe Lautert <filipe@icewall.org> |
| 50 | Franck Bui-Huu <vagabon.xyz@gmail.com> | 50 | Franck Bui-Huu <vagabon.xyz@gmail.com> |
| 51 | Frank Rowand <frowand.list@gmail.com> <frowand@mvista.com> | ||
| 52 | Frank Rowand <frowand.list@gmail.com> <frank.rowand@am.sony.com> | ||
| 53 | Frank Rowand <frowand.list@gmail.com> <frank.rowand@sonymobile.com> | ||
| 51 | Frank Zago <fzago@systemfabricworks.com> | 54 | Frank Zago <fzago@systemfabricworks.com> |
| 52 | Greg Kroah-Hartman <greg@echidna.(none)> | 55 | Greg Kroah-Hartman <greg@echidna.(none)> |
| 53 | Greg Kroah-Hartman <gregkh@suse.de> | 56 | Greg Kroah-Hartman <gregkh@suse.de> |
| @@ -79,6 +82,7 @@ Kay Sievers <kay.sievers@vrfy.org> · 25 unmodified lines | |||
| 79 | Kenneth W Chen <kenneth.w.chen@intel.com> | 82 | Kenneth W Chen <kenneth.w.chen@intel.com> |
| 80 | Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> | 83 | Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> |
| 81 | Koushik <raghavendra.koushik@neterion.com> | 84 | Koushik <raghavendra.koushik@neterion.com> |
| 85 | Krzysztof Kozlowski <krzk@kernel.org> <k.kozlowski.k@gmail.com> | ||
| 82 | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 86 | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 83 | Leonid I Ananiev <leonid.i.ananiev@intel.com> | 87 | Leonid I Ananiev <leonid.i.ananiev@intel.com> |
| 84 | Linas Vepstas <linas@austin.ibm.com> | 88 | Linas Vepstas <linas@austin.ibm.com> |
| @@ -581,15 +581,16 @@ Specify "[Nn]ode" for node order · 580 unmodified lines | |||
| 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 |
| 582 | zone. Specify "[Zz]one" for zone order. | 582 | zone. Specify "[Zz]one" for zone order. |
| 583 | 583 | ||
| 584 | Specify "[Dd]efault" to request automatic configuration. Autoconfiguration | 584 | Specify "[Dd]efault" to request automatic configuration. |
| 585 | will select "node" order in following case. | 585 | |
| 586 | (1) if the DMA zone does not exist or | 586 | On 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 | 587 | by 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. | 589 | On 64-bit, devices that require DMA32/DMA are relatively rare, so "node" |
| 590 | 590 | order will be selected. | |
| 591 | Otherwise, "zone" order will be selected. Default order is recommended unless | 591 | |
| 592 | this is causing problems for your system/application. | 592 | Default order is recommended unless this is causing problems for your |
| 593 | system/application. | ||
| 593 | 594 | ||
| 594 | ============================================================== | 595 | ============================================================== |
| 595 | 596 | ||
| @@ -6400,7 +6400,7 @@ F: mm/kmemleak.c · 6399 unmodified lines | |||
| 6400 | F: mm/kmemleak-test.c | 6400 | F: mm/kmemleak-test.c |
| 6401 | 6401 | ||
| 6402 | KPROBES | 6402 | KPROBES |
| 6403 | M: Ananth N Mavinakayanahalli <ananth@in.ibm.com> | 6403 | M: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com> |
| 6404 | M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> | 6404 | M: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> |
| 6405 | M: "David S. Miller" <davem@davemloft.net> | 6405 | M: "David S. Miller" <davem@davemloft.net> |
| 6406 | M: Masami Hiramatsu <mhiramat@kernel.org> | 6406 | M: Masami Hiramatsu <mhiramat@kernel.org> |
| @@ -2669,9 +2669,9 @@ static int __init mport_init(void) · 2668 unmodified lines | |||
| 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); |
| @@ -2455,6 +2455,8 @@ int dlm_deref_lockres_done_handler(struct o2net_msg *msg, u32 len, void *data, · 2454 unmodified lines | |||
| 2455 | 2455 | ||
| 2456 | spin_unlock(&dlm->spinlock); | 2456 | spin_unlock(&dlm->spinlock); |
| 2457 | 2457 | ||
| 2458 | ret = 0; | ||
| 2459 | |||
| 2458 | done: | 2460 | done: |
| 2459 | dlm_put(dlm); | 2461 | dlm_put(dlm); |
| 2460 | return ret; | 2462 | return ret; |
| @@ -1518,6 +1518,32 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma, · 1517 unmodified lines | |||
| 1518 | return page; | 1518 | return page; |
| 1519 | } | 1519 | } |
| 1520 | 1520 | ||
| 1521 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
| 1522 | static 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 | |||
| 1521 | static int gather_pte_stats(pmd_t *pmd, unsigned long addr, | 1547 | static 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, · 3 unmodified lines | |||
| 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, · 1 unmodified line | |||
| 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); |
| @@ -152,6 +152,7 @@ static inline bool is_huge_zero_pmd(pmd_t pmd) · 151 unmodified lines | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | struct page *get_huge_zero_page(void); | 154 | struct page *get_huge_zero_page(void); |
| 155 | void 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) · 50 unmodified lines | |||
| 208 | return false; | 209 | return false; |
| 209 | } | 210 | } |
| 210 | 211 | ||
| 212 | static inline void put_huge_zero_page(void) | ||
| 213 | { | ||
| 214 | BUILD_BUG(); | ||
| 215 | } | ||
| 211 | 216 | ||
| 212 | static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma, | 217 | static 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) |
| @@ -1031,6 +1031,8 @@ static inline bool page_mapped(struct page *page) · 1030 unmodified lines | |||
| 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 { · 101 unmodified lines | |||
| 1138 | 1140 | ||
| 1139 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, | 1141 | struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, |
| 1140 | pte_t pte); | 1142 | pte_t pte); |
| 1143 | struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, | ||
| 1144 | pmd_t pmd); | ||
| 1141 | 1145 | ||
| 1142 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, | 1146 | int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, |
| 1143 | unsigned long size); | 1147 | unsigned long size); |
| @@ -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 { · 37 unmodified lines | |||
| 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 | */ |
| 46 | void __sanitizer_cov_trace_pc(void) | 47 | void 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; |
| @@ -1415,6 +1415,9 @@ static int __init crash_save_vmcoreinfo_init(void) · 1414 unmodified lines | |||
| 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) · 26 unmodified lines | |||
| 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(); |
| @@ -210,10 +210,6 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace, · 209 unmodified lines | |||
| 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 | /* |
| @@ -232,7 +232,7 @@ retry: · 231 unmodified lines | |||
| 232 | return READ_ONCE(huge_zero_page); | 232 | return READ_ONCE(huge_zero_page); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | static void put_huge_zero_page(void) | 235 | void 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, · 1445 unmodified lines | |||
| 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, · 264 unmodified lines | |||
| 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) · 382 unmodified lines | |||
| 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 | ||
| 2359 | static void collapse_huge_page(struct mm_struct *mm, | 2357 | static void collapse_huge_page(struct mm_struct *mm, |
| @@ -888,7 +888,15 @@ int get_hwpoison_page(struct page *page) · 887 unmodified lines | |||
| 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 | } |
| 893 | EXPORT_SYMBOL_GPL(get_hwpoison_page); | 901 | EXPORT_SYMBOL_GPL(get_hwpoison_page); |
| 894 | 902 | ||
| @@ -789,6 +789,46 @@ out: · 788 unmodified lines | |||
| 789 | return pfn_to_page(pfn); | 789 | return pfn_to_page(pfn); |
| 790 | } | 790 | } |
| 791 | 791 | ||
| 792 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
| 793 | struct 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 | */ | ||
| 827 | out: | ||
| 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 |
| @@ -975,7 +975,13 @@ out: · 974 unmodified lines | |||
| 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(); |
| @@ -353,7 +353,11 @@ int swap_readpage(struct page *page) · 352 unmodified lines | |||
| 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 | } |
| @@ -728,6 +728,11 @@ void release_pages(struct page **pages, int nr, bool cold) · 727 unmodified lines | |||
| 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; |
| @@ -2553,7 +2553,7 @@ static bool shrink_zones(struct zonelist *zonelist, struct scan_control *sc) · 2552 unmodified lines | |||
| 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, · 758 unmodified lines | |||
| 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, · 17 unmodified lines | |||
| 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 | ||