diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-11-07 10:53:06 +0100 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-11-07 10:53:06 +0100 |
commit | b3d9a136815ca9284ade2a897a3b7d2b0084c33c (patch) | |
tree | af222e53d833ff7218577cf98e1b856d9d6bda93 /mm | |
parent | c7da092a1f243bfd1bfb4124f538e69e941882da (diff) | |
parent | e4880bc5dfb1f02b152e62a894b5c6f3e995b3cf (diff) | |
download | op-kernel-dev-b3d9a136815ca9284ade2a897a3b7d2b0084c33c.zip op-kernel-dev-b3d9a136815ca9284ade2a897a3b7d2b0084c33c.tar.gz |
Merge branch 'linus' into x86/asm, to pick up fixes and resolve conflicts
Conflicts:
arch/x86/kernel/cpu/Makefile
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm')
56 files changed, 103 insertions, 8 deletions
diff --git a/mm/Makefile b/mm/Makefile index e3ac3ae..4659b93 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 # # Makefile for the linux memory manager. # diff --git a/mm/bootmem.c b/mm/bootmem.c index 9fedb27..6aef642 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * bootmem - A boot-time physical memory allocator and configurator * @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __MM_CMA_H__ #define __MM_CMA_H__ diff --git a/mm/cma_debug.c b/mm/cma_debug.c index c03ccbc..275df8b 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * CMA DebugFS Interface * diff --git a/mm/compaction.c b/mm/compaction.c index 03d31a8..85395dc 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/compaction.c * @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mm/debug.c * diff --git a/mm/debug_page_ref.c b/mm/debug_page_ref.c index 1aef3d5..f3b2c9d 100644 --- a/mm/debug_page_ref.c +++ b/mm/debug_page_ref.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/mm_types.h> #include <linux/tracepoint.h> diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c index b1dd4a9..d04ac1e 100644 --- a/mm/early_ioremap.c +++ b/mm/early_ioremap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Provide common bits of early_ioremap() support for architectures needing * temporary mappings during boot before ioremap() is available. diff --git a/mm/fadvise.c b/mm/fadvise.c index 702f239..ec70d6e 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mm/fadvise.c * diff --git a/mm/failslab.c b/mm/failslab.c index b0fac98..8087d97 100644 --- a/mm/failslab.c +++ b/mm/failslab.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/fault-inject.h> #include <linux/slab.h> #include <linux/mm.h> diff --git a/mm/frame_vector.c b/mm/frame_vector.c index 72ebec1..2f98df0 100644 --- a/mm/frame_vector.c +++ b/mm/frame_vector.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include <linux/errno.h> #include <linux/err.h> diff --git a/mm/highmem.c b/mm/highmem.c index 50b4ca6..59db322 100644 --- a/mm/highmem.c +++ b/mm/highmem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * High memory handling common code and variables. * diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 269b5df..1981ed6 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -941,6 +941,9 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, pmd = pmd_swp_mksoft_dirty(pmd); set_pmd_at(src_mm, addr, src_pmd, pmd); } + add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR); + atomic_long_inc(&dst_mm->nr_ptes); + pgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable); set_pmd_at(dst_mm, addr, dst_pmd, pmd); ret = 0; goto out_unlock; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 424b0ef..2d2ff5e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3984,6 +3984,9 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, unsigned long src_addr, struct page **pagep) { + struct address_space *mapping; + pgoff_t idx; + unsigned long size; int vm_shared = dst_vma->vm_flags & VM_SHARED; struct hstate *h = hstate_vma(dst_vma); pte_t _dst_pte; @@ -4021,13 +4024,24 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, __SetPageUptodate(page); set_page_huge_active(page); + mapping = dst_vma->vm_file->f_mapping; + idx = vma_hugecache_offset(h, dst_vma, dst_addr); + /* * If shared, add to page cache */ if (vm_shared) { - struct address_space *mapping = dst_vma->vm_file->f_mapping; - pgoff_t idx = vma_hugecache_offset(h, dst_vma, dst_addr); + size = i_size_read(mapping->host) >> huge_page_shift(h); + ret = -EFAULT; + if (idx >= size) + goto out_release_nounlock; + /* + * Serialization between remove_inode_hugepages() and + * huge_add_to_page_cache() below happens through the + * hugetlb_fault_mutex_table that here must be hold by + * the caller. + */ ret = huge_add_to_page_cache(page, mapping, idx); if (ret) goto out_release_nounlock; @@ -4036,6 +4050,20 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, ptl = huge_pte_lockptr(h, dst_mm, dst_pte); spin_lock(ptl); + /* + * Recheck the i_size after holding PT lock to make sure not + * to leave any page mapped (as page_mapped()) beyond the end + * of the i_size (remove_inode_hugepages() is strict about + * enforcing that). If we bail out here, we'll also leave a + * page in the radix tree in the vm_shared case beyond the end + * of the i_size, but remove_inode_hugepages() will take care + * of it as soon as we drop the hugetlb_fault_mutex_table. + */ + size = i_size_read(mapping->host) >> huge_page_shift(h); + ret = -EFAULT; + if (idx >= size) + goto out_release_unlock; + ret = -EEXIST; if (!huge_pte_none(huge_ptep_get(dst_pte))) goto out_release_unlock; diff --git a/mm/init-mm.c b/mm/init-mm.c index 975e49f..f94d5d1 100644 --- a/mm/init-mm.c +++ b/mm/init-mm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/mm_types.h> #include <linux/rbtree.h> #include <linux/rwsem.h> diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile index 2976a9e..3289db3 100644 --- a/mm/kasan/Makefile +++ b/mm/kasan/Makefile @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 KASAN_SANITIZE := n UBSAN_SANITIZE_kasan.o := n KCOV_INSTRUMENT := n diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 1229298..c70851a 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __MM_KASAN_KASAN_H #define __MM_KASAN_KASAN_H diff --git a/mm/khugepaged.c b/mm/khugepaged.c index c01f177..43cb304 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/mm.h> diff --git a/mm/kmemcheck.c b/mm/kmemcheck.c index 2d5959c..800d64b 100644 --- a/mm/kmemcheck.c +++ b/mm/kmemcheck.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/gfp.h> #include <linux/mm_types.h> #include <linux/mm.h> diff --git a/mm/madvise.c b/mm/madvise.c index fd70d6a..375cf32 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/madvise.c * diff --git a/mm/mempool.c b/mm/mempool.c index 1c02948..c4a23cd 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/mempool.c * diff --git a/mm/memtest.c b/mm/memtest.c index 8eaa4c3..f53ace7 100644 --- a/mm/memtest.c +++ b/mm/memtest.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include <linux/types.h> #include <linux/init.h> diff --git a/mm/migrate.c b/mm/migrate.c index e00814c..1236449 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Memory Migration functionality - linux/mm/migrate.c * diff --git a/mm/mincore.c b/mm/mincore.c index c5687c4..fc37afe 100644 --- a/mm/mincore.c +++ b/mm/mincore.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/mincore.c * @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/mlock.c * diff --git a/mm/mmzone.c b/mm/mmzone.c index a51c0a6..4686fdc 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/mmzone.c * diff --git a/mm/mprotect.c b/mm/mprotect.c index 6d3e2f0..ec39f730 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mm/mprotect.c * diff --git a/mm/mremap.c b/mm/mremap.c index cfec004..049470a 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mm/mremap.c * @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/msync.c * diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 3637809..9b02fda 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * bootmem - A boot-time physical memory allocator and configurator * diff --git a/mm/page_counter.c b/mm/page_counter.c index 7c6a63d..2a8df3a 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Lockless hierarchical page accounting & limiting * diff --git a/mm/page_ext.c b/mm/page_ext.c index 32f1891..4f0367d 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/mm.h> #include <linux/mmzone.h> #include <linux/bootmem.h> diff --git a/mm/page_idle.c b/mm/page_idle.c index 4bd03a8..0a49374 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/init.h> #include <linux/bootmem.h> #include <linux/fs.h> diff --git a/mm/page_io.c b/mm/page_io.c index 21502d3..5d882de 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/page_io.c * diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 757410d..44f2139 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/page_isolation.c */ diff --git a/mm/page_owner.c b/mm/page_owner.c index 57abca6..4f44b95 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/debugfs.h> #include <linux/mm.h> #include <linux/slab.h> diff --git a/mm/page_poison.c b/mm/page_poison.c index be19e98..e83fd44 100644 --- a/mm/page_poison.c +++ b/mm/page_poison.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/kernel.h> #include <linux/string.h> #include <linux/mm.h> diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index 53afbb9..d22b843 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/mm.h> #include <linux/rmap.h> #include <linux/hugetlb.h> diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 1a41979..8bd4afa 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/mm.h> #include <linux/highmem.h> #include <linux/sched.h> diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index 7065faf..b1739dc 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MM_PERCPU_INTERNAL_H #define _MM_PERCPU_INTERNAL_H diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 1175f6a..1e4ee76 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mm/pgtable-generic.c * diff --git a/mm/quicklist.c b/mm/quicklist.c index daf6ff6..5e98ac7 100644 --- a/mm/quicklist.c +++ b/mm/quicklist.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Quicklist support. * @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/slab.c * Written by Mark Hemment, 1996/97. @@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef MM_SLAB_H #define MM_SLAB_H /* diff --git a/mm/slab_common.c b/mm/slab_common.c index 8016459..0d7fe71 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Slab allocator functions that are independent of the allocator strategy * @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * SLOB Allocator: Simple List Of Blocks * @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * SLUB: A slab allocator that limits cache line use instead of queuing * objects in per cpu and per node lists. diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index d1a39b8..478ce6d 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Virtual Memory Map support * diff --git a/mm/sparse.c b/mm/sparse.c index b00a973..0441388 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * sparse memory mappings. */ diff --git a/mm/swap_cgroup.c b/mm/swap_cgroup.c index fcd2740..45affae 100644 --- a/mm/swap_cgroup.c +++ b/mm/swap_cgroup.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 #include <linux/swap_cgroup.h> #include <linux/vmalloc.h> #include <linux/mm.h> diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 13a1740..d81cfc5a 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Manage cache of swap slots to be used for and returned from * swap. diff --git a/mm/swap_state.c b/mm/swap_state.c index 05b6803..3264394 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/swap_state.c * diff --git a/mm/swapfile.c b/mm/swapfile.c index bf91dc9..e47a21e 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2869,6 +2869,7 @@ static struct swap_info_struct *alloc_swap_info(void) p->flags = SWP_USED; spin_unlock(&swap_lock); spin_lock_init(&p->lock); + spin_lock_init(&p->cont_lock); return p; } @@ -3545,6 +3546,7 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask) head = vmalloc_to_page(si->swap_map + offset); offset &= ~PAGE_MASK; + spin_lock(&si->cont_lock); /* * Page allocation does not initialize the page's lru field, * but it does always reset its private field. @@ -3564,7 +3566,7 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask) * a continuation page, free our allocation and use this one. */ if (!(count & COUNT_CONTINUED)) - goto out; + goto out_unlock_cont; map = kmap_atomic(list_page) + offset; count = *map; @@ -3575,11 +3577,13 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask) * free our allocation and use this one. */ if ((count & ~COUNT_CONTINUED) != SWAP_CONT_MAX) - goto out; + goto out_unlock_cont; } list_add_tail(&page->lru, &head->lru); page = NULL; /* now it's attached, don't free it */ +out_unlock_cont: + spin_unlock(&si->cont_lock); out: unlock_cluster(ci); spin_unlock(&si->lock); @@ -3604,6 +3608,7 @@ static bool swap_count_continued(struct swap_info_struct *si, struct page *head; struct page *page; unsigned char *map; + bool ret; head = vmalloc_to_page(si->swap_map + offset); if (page_private(head) != SWP_CONTINUED) { @@ -3611,6 +3616,7 @@ static bool swap_count_continued(struct swap_info_struct *si, return false; /* need to add count continuation */ } + spin_lock(&si->cont_lock); offset &= ~PAGE_MASK; page = list_entry(head->lru.next, struct page, lru); map = kmap_atomic(page) + offset; @@ -3631,8 +3637,10 @@ static bool swap_count_continued(struct swap_info_struct *si, if (*map == SWAP_CONT_MAX) { kunmap_atomic(map); page = list_entry(page->lru.next, struct page, lru); - if (page == head) - return false; /* add count continuation */ + if (page == head) { + ret = false; /* add count continuation */ + goto out; + } map = kmap_atomic(page) + offset; init_map: *map = 0; /* we didn't zero the page */ } @@ -3645,7 +3653,7 @@ init_map: *map = 0; /* we didn't zero the page */ kunmap_atomic(map); page = list_entry(page->lru.prev, struct page, lru); } - return true; /* incremented */ + ret = true; /* incremented */ } else { /* decrementing */ /* @@ -3671,8 +3679,11 @@ init_map: *map = 0; /* we didn't zero the page */ kunmap_atomic(map); page = list_entry(page->lru.prev, struct page, lru); } - return count == COUNT_CONTINUED; + ret = count == COUNT_CONTINUED; } +out: + spin_unlock(&si->cont_lock); + return ret; } /* diff --git a/mm/vmacache.c b/mm/vmacache.c index 7ffa0ee..db7596e 100644 --- a/mm/vmacache.c +++ b/mm/vmacache.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2014 Davidlohr Bueso. */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 13d711d..eb2f031 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * linux/mm/vmscan.c * diff --git a/mm/workingset.c b/mm/workingset.c index 7119cd7..b997c9d 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Workingset detection * |