diff options
Diffstat (limited to 'mm')
56 files changed, 103 insertions, 8 deletions
diff --git a/mm/Makefile b/mm/Makefile index e3ac3aeb533b..4659b93cba43 100644 --- a/mm/Makefile +++ b/mm/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | # | 2 | # |
2 | # Makefile for the linux memory manager. | 3 | # Makefile for the linux memory manager. |
3 | # | 4 | # |
diff --git a/mm/bootmem.c b/mm/bootmem.c index 9fedb27c6451..6aef64254203 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * bootmem - A boot-time physical memory allocator and configurator | 3 | * bootmem - A boot-time physical memory allocator and configurator |
3 | * | 4 | * |
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MM_CMA_H__ | 2 | #ifndef __MM_CMA_H__ |
2 | #define __MM_CMA_H__ | 3 | #define __MM_CMA_H__ |
3 | 4 | ||
diff --git a/mm/cma_debug.c b/mm/cma_debug.c index c03ccbc405a0..275df8b5b22e 100644 --- a/mm/cma_debug.c +++ b/mm/cma_debug.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * CMA DebugFS Interface | 3 | * CMA DebugFS Interface |
3 | * | 4 | * |
diff --git a/mm/compaction.c b/mm/compaction.c index 03d31a875341..85395dc6eb13 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/compaction.c | 3 | * linux/mm/compaction.c |
3 | * | 4 | * |
diff --git a/mm/debug.c b/mm/debug.c index 5715448ab0b5..6726bec731c9 100644 --- a/mm/debug.c +++ b/mm/debug.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * mm/debug.c | 3 | * mm/debug.c |
3 | * | 4 | * |
diff --git a/mm/debug_page_ref.c b/mm/debug_page_ref.c index 1aef3d562e52..f3b2c9d3ece2 100644 --- a/mm/debug_page_ref.c +++ b/mm/debug_page_ref.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/mm_types.h> | 2 | #include <linux/mm_types.h> |
2 | #include <linux/tracepoint.h> | 3 | #include <linux/tracepoint.h> |
3 | 4 | ||
diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c index b1dd4a948fc0..d04ac1ec0559 100644 --- a/mm/early_ioremap.c +++ b/mm/early_ioremap.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Provide common bits of early_ioremap() support for architectures needing | 3 | * Provide common bits of early_ioremap() support for architectures needing |
3 | * temporary mappings during boot before ioremap() is available. | 4 | * temporary mappings during boot before ioremap() is available. |
diff --git a/mm/fadvise.c b/mm/fadvise.c index 702f239cd6db..ec70d6e4b86d 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * mm/fadvise.c | 3 | * mm/fadvise.c |
3 | * | 4 | * |
diff --git a/mm/failslab.c b/mm/failslab.c index b0fac98cd938..8087d976a809 100644 --- a/mm/failslab.c +++ b/mm/failslab.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/fault-inject.h> | 2 | #include <linux/fault-inject.h> |
2 | #include <linux/slab.h> | 3 | #include <linux/slab.h> |
3 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
diff --git a/mm/frame_vector.c b/mm/frame_vector.c index 72ebec18629c..2f98df0d460e 100644 --- a/mm/frame_vector.c +++ b/mm/frame_vector.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <linux/errno.h> | 3 | #include <linux/errno.h> |
3 | #include <linux/err.h> | 4 | #include <linux/err.h> |
diff --git a/mm/highmem.c b/mm/highmem.c index 50b4ca6787f0..59db3223a5d6 100644 --- a/mm/highmem.c +++ b/mm/highmem.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * High memory handling common code and variables. | 3 | * High memory handling common code and variables. |
3 | * | 4 | * |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 269b5df58543..1981ed697dab 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, | |||
941 | pmd = pmd_swp_mksoft_dirty(pmd); | 941 | pmd = pmd_swp_mksoft_dirty(pmd); |
942 | set_pmd_at(src_mm, addr, src_pmd, pmd); | 942 | set_pmd_at(src_mm, addr, src_pmd, pmd); |
943 | } | 943 | } |
944 | add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR); | ||
945 | atomic_long_inc(&dst_mm->nr_ptes); | ||
946 | pgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable); | ||
944 | set_pmd_at(dst_mm, addr, dst_pmd, pmd); | 947 | set_pmd_at(dst_mm, addr, dst_pmd, pmd); |
945 | ret = 0; | 948 | ret = 0; |
946 | goto out_unlock; | 949 | goto out_unlock; |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 424b0ef08a60..2d2ff5e8bf2b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -3984,6 +3984,9 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, | |||
3984 | unsigned long src_addr, | 3984 | unsigned long src_addr, |
3985 | struct page **pagep) | 3985 | struct page **pagep) |
3986 | { | 3986 | { |
3987 | struct address_space *mapping; | ||
3988 | pgoff_t idx; | ||
3989 | unsigned long size; | ||
3987 | int vm_shared = dst_vma->vm_flags & VM_SHARED; | 3990 | int vm_shared = dst_vma->vm_flags & VM_SHARED; |
3988 | struct hstate *h = hstate_vma(dst_vma); | 3991 | struct hstate *h = hstate_vma(dst_vma); |
3989 | pte_t _dst_pte; | 3992 | pte_t _dst_pte; |
@@ -4021,13 +4024,24 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, | |||
4021 | __SetPageUptodate(page); | 4024 | __SetPageUptodate(page); |
4022 | set_page_huge_active(page); | 4025 | set_page_huge_active(page); |
4023 | 4026 | ||
4027 | mapping = dst_vma->vm_file->f_mapping; | ||
4028 | idx = vma_hugecache_offset(h, dst_vma, dst_addr); | ||
4029 | |||
4024 | /* | 4030 | /* |
4025 | * If shared, add to page cache | 4031 | * If shared, add to page cache |
4026 | */ | 4032 | */ |
4027 | if (vm_shared) { | 4033 | if (vm_shared) { |
4028 | struct address_space *mapping = dst_vma->vm_file->f_mapping; | 4034 | size = i_size_read(mapping->host) >> huge_page_shift(h); |
4029 | pgoff_t idx = vma_hugecache_offset(h, dst_vma, dst_addr); | 4035 | ret = -EFAULT; |
4036 | if (idx >= size) | ||
4037 | goto out_release_nounlock; | ||
4030 | 4038 | ||
4039 | /* | ||
4040 | * Serialization between remove_inode_hugepages() and | ||
4041 | * huge_add_to_page_cache() below happens through the | ||
4042 | * hugetlb_fault_mutex_table that here must be hold by | ||
4043 | * the caller. | ||
4044 | */ | ||
4031 | ret = huge_add_to_page_cache(page, mapping, idx); | 4045 | ret = huge_add_to_page_cache(page, mapping, idx); |
4032 | if (ret) | 4046 | if (ret) |
4033 | goto out_release_nounlock; | 4047 | goto out_release_nounlock; |
@@ -4036,6 +4050,20 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, | |||
4036 | ptl = huge_pte_lockptr(h, dst_mm, dst_pte); | 4050 | ptl = huge_pte_lockptr(h, dst_mm, dst_pte); |
4037 | spin_lock(ptl); | 4051 | spin_lock(ptl); |
4038 | 4052 | ||
4053 | /* | ||
4054 | * Recheck the i_size after holding PT lock to make sure not | ||
4055 | * to leave any page mapped (as page_mapped()) beyond the end | ||
4056 | * of the i_size (remove_inode_hugepages() is strict about | ||
4057 | * enforcing that). If we bail out here, we'll also leave a | ||
4058 | * page in the radix tree in the vm_shared case beyond the end | ||
4059 | * of the i_size, but remove_inode_hugepages() will take care | ||
4060 | * of it as soon as we drop the hugetlb_fault_mutex_table. | ||
4061 | */ | ||
4062 | size = i_size_read(mapping->host) >> huge_page_shift(h); | ||
4063 | ret = -EFAULT; | ||
4064 | if (idx >= size) | ||
4065 | goto out_release_unlock; | ||
4066 | |||
4039 | ret = -EEXIST; | 4067 | ret = -EEXIST; |
4040 | if (!huge_pte_none(huge_ptep_get(dst_pte))) | 4068 | if (!huge_pte_none(huge_ptep_get(dst_pte))) |
4041 | goto out_release_unlock; | 4069 | goto out_release_unlock; |
diff --git a/mm/init-mm.c b/mm/init-mm.c index 975e49f00f34..f94d5d15ebc0 100644 --- a/mm/init-mm.c +++ b/mm/init-mm.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/mm_types.h> | 2 | #include <linux/mm_types.h> |
2 | #include <linux/rbtree.h> | 3 | #include <linux/rbtree.h> |
3 | #include <linux/rwsem.h> | 4 | #include <linux/rwsem.h> |
diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile index 2976a9ee104f..3289db38bc87 100644 --- a/mm/kasan/Makefile +++ b/mm/kasan/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # SPDX-License-Identifier: GPL-2.0 | ||
1 | KASAN_SANITIZE := n | 2 | KASAN_SANITIZE := n |
2 | UBSAN_SANITIZE_kasan.o := n | 3 | UBSAN_SANITIZE_kasan.o := n |
3 | KCOV_INSTRUMENT := n | 4 | KCOV_INSTRUMENT := n |
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index 1229298cce64..c70851a9a6a4 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef __MM_KASAN_KASAN_H | 2 | #ifndef __MM_KASAN_KASAN_H |
2 | #define __MM_KASAN_KASAN_H | 3 | #define __MM_KASAN_KASAN_H |
3 | 4 | ||
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index c01f177a1120..43cb3043311b 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 2 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
2 | 3 | ||
3 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
diff --git a/mm/kmemcheck.c b/mm/kmemcheck.c index 2d5959c5f7c5..800d64b854ea 100644 --- a/mm/kmemcheck.c +++ b/mm/kmemcheck.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/gfp.h> | 2 | #include <linux/gfp.h> |
2 | #include <linux/mm_types.h> | 3 | #include <linux/mm_types.h> |
3 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
diff --git a/mm/madvise.c b/mm/madvise.c index fd70d6aabc3e..375cf32087e4 100644 --- a/mm/madvise.c +++ b/mm/madvise.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/madvise.c | 3 | * linux/mm/madvise.c |
3 | * | 4 | * |
diff --git a/mm/mempool.c b/mm/mempool.c index 1c0294858527..c4a23cdae3f0 100644 --- a/mm/mempool.c +++ b/mm/mempool.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/mempool.c | 3 | * linux/mm/mempool.c |
3 | * | 4 | * |
diff --git a/mm/memtest.c b/mm/memtest.c index 8eaa4c3a5f65..f53ace709ccd 100644 --- a/mm/memtest.c +++ b/mm/memtest.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <linux/types.h> | 3 | #include <linux/types.h> |
3 | #include <linux/init.h> | 4 | #include <linux/init.h> |
diff --git a/mm/migrate.c b/mm/migrate.c index e00814ca390e..1236449b4777 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Memory Migration functionality - linux/mm/migrate.c | 3 | * Memory Migration functionality - linux/mm/migrate.c |
3 | * | 4 | * |
diff --git a/mm/mincore.c b/mm/mincore.c index c5687c45c326..fc37afe226e6 100644 --- a/mm/mincore.c +++ b/mm/mincore.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/mincore.c | 3 | * linux/mm/mincore.c |
3 | * | 4 | * |
diff --git a/mm/mlock.c b/mm/mlock.c index dfc6f1912176..46af369c13e5 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/mlock.c | 3 | * linux/mm/mlock.c |
3 | * | 4 | * |
diff --git a/mm/mmzone.c b/mm/mmzone.c index a51c0a67ea3d..4686fdc23bb9 100644 --- a/mm/mmzone.c +++ b/mm/mmzone.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/mmzone.c | 3 | * linux/mm/mmzone.c |
3 | * | 4 | * |
diff --git a/mm/mprotect.c b/mm/mprotect.c index 6d3e2f082290..ec39f730a0bf 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * mm/mprotect.c | 3 | * mm/mprotect.c |
3 | * | 4 | * |
diff --git a/mm/mremap.c b/mm/mremap.c index cfec004c4ff9..049470aa1e3e 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * mm/mremap.c | 3 | * mm/mremap.c |
3 | * | 4 | * |
diff --git a/mm/msync.c b/mm/msync.c index 24e612fefa04..ef30a429623a 100644 --- a/mm/msync.c +++ b/mm/msync.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/msync.c | 3 | * linux/mm/msync.c |
3 | * | 4 | * |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 3637809a18d0..9b02fda0886b 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * bootmem - A boot-time physical memory allocator and configurator | 3 | * bootmem - A boot-time physical memory allocator and configurator |
3 | * | 4 | * |
diff --git a/mm/page_counter.c b/mm/page_counter.c index 7c6a63d2c27f..2a8df3ad60a4 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Lockless hierarchical page accounting & limiting | 3 | * Lockless hierarchical page accounting & limiting |
3 | * | 4 | * |
diff --git a/mm/page_ext.c b/mm/page_ext.c index 32f18911deda..4f0367d472c4 100644 --- a/mm/page_ext.c +++ b/mm/page_ext.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/mm.h> | 2 | #include <linux/mm.h> |
2 | #include <linux/mmzone.h> | 3 | #include <linux/mmzone.h> |
3 | #include <linux/bootmem.h> | 4 | #include <linux/bootmem.h> |
diff --git a/mm/page_idle.c b/mm/page_idle.c index 4bd03a8d809e..0a49374e6931 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/init.h> | 2 | #include <linux/init.h> |
2 | #include <linux/bootmem.h> | 3 | #include <linux/bootmem.h> |
3 | #include <linux/fs.h> | 4 | #include <linux/fs.h> |
diff --git a/mm/page_io.c b/mm/page_io.c index 21502d341a67..5d882de3fbfd 100644 --- a/mm/page_io.c +++ b/mm/page_io.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/page_io.c | 3 | * linux/mm/page_io.c |
3 | * | 4 | * |
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 757410d9f758..44f213935bf6 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/page_isolation.c | 3 | * linux/mm/page_isolation.c |
3 | */ | 4 | */ |
diff --git a/mm/page_owner.c b/mm/page_owner.c index 57abca62d4db..4f44b95b9d1e 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/debugfs.h> | 2 | #include <linux/debugfs.h> |
2 | #include <linux/mm.h> | 3 | #include <linux/mm.h> |
3 | #include <linux/slab.h> | 4 | #include <linux/slab.h> |
diff --git a/mm/page_poison.c b/mm/page_poison.c index be19e989ccff..e83fd44867de 100644 --- a/mm/page_poison.c +++ b/mm/page_poison.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/kernel.h> | 2 | #include <linux/kernel.h> |
2 | #include <linux/string.h> | 3 | #include <linux/string.h> |
3 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
diff --git a/mm/page_vma_mapped.c b/mm/page_vma_mapped.c index 53afbb919a1c..d22b84310f6d 100644 --- a/mm/page_vma_mapped.c +++ b/mm/page_vma_mapped.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/mm.h> | 2 | #include <linux/mm.h> |
2 | #include <linux/rmap.h> | 3 | #include <linux/rmap.h> |
3 | #include <linux/hugetlb.h> | 4 | #include <linux/hugetlb.h> |
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 1a4197965415..8bd4afa83cb8 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/mm.h> | 2 | #include <linux/mm.h> |
2 | #include <linux/highmem.h> | 3 | #include <linux/highmem.h> |
3 | #include <linux/sched.h> | 4 | #include <linux/sched.h> |
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index 7065faf74b46..b1739dc06b73 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h | |||
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef _MM_PERCPU_INTERNAL_H | 2 | #ifndef _MM_PERCPU_INTERNAL_H |
2 | #define _MM_PERCPU_INTERNAL_H | 3 | #define _MM_PERCPU_INTERNAL_H |
3 | 4 | ||
diff --git a/mm/pgtable-generic.c b/mm/pgtable-generic.c index 1175f6a24fdb..1e4ee763c190 100644 --- a/mm/pgtable-generic.c +++ b/mm/pgtable-generic.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * mm/pgtable-generic.c | 3 | * mm/pgtable-generic.c |
3 | * | 4 | * |
diff --git a/mm/quicklist.c b/mm/quicklist.c index daf6ff6e199a..5e98ac78e410 100644 --- a/mm/quicklist.c +++ b/mm/quicklist.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Quicklist support. | 3 | * Quicklist support. |
3 | * | 4 | * |
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/slab.c | 3 | * linux/mm/slab.c |
3 | * Written by Mark Hemment, 1996/97. | 4 | * Written by Mark Hemment, 1996/97. |
@@ -1,3 +1,4 @@ | |||
1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
1 | #ifndef MM_SLAB_H | 2 | #ifndef MM_SLAB_H |
2 | #define MM_SLAB_H | 3 | #define MM_SLAB_H |
3 | /* | 4 | /* |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 80164599ca5d..0d7fe71ff5e4 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Slab allocator functions that are independent of the allocator strategy | 3 | * Slab allocator functions that are independent of the allocator strategy |
3 | * | 4 | * |
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SLOB Allocator: Simple List Of Blocks | 3 | * SLOB Allocator: Simple List Of Blocks |
3 | * | 4 | * |
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * SLUB: A slab allocator that limits cache line use instead of queuing | 3 | * SLUB: A slab allocator that limits cache line use instead of queuing |
3 | * objects in per cpu and per node lists. | 4 | * objects in per cpu and per node lists. |
diff --git a/mm/sparse-vmemmap.c b/mm/sparse-vmemmap.c index d1a39b8051e0..478ce6d4a2c4 100644 --- a/mm/sparse-vmemmap.c +++ b/mm/sparse-vmemmap.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Virtual Memory Map support | 3 | * Virtual Memory Map support |
3 | * | 4 | * |
diff --git a/mm/sparse.c b/mm/sparse.c index b00a97398795..044138852baf 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * sparse memory mappings. | 3 | * sparse memory mappings. |
3 | */ | 4 | */ |
diff --git a/mm/swap_cgroup.c b/mm/swap_cgroup.c index fcd2740f4ed7..45affaef3bc6 100644 --- a/mm/swap_cgroup.c +++ b/mm/swap_cgroup.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | #include <linux/swap_cgroup.h> | 2 | #include <linux/swap_cgroup.h> |
2 | #include <linux/vmalloc.h> | 3 | #include <linux/vmalloc.h> |
3 | #include <linux/mm.h> | 4 | #include <linux/mm.h> |
diff --git a/mm/swap_slots.c b/mm/swap_slots.c index 13a174006b91..d81cfc5a43d5 100644 --- a/mm/swap_slots.c +++ b/mm/swap_slots.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Manage cache of swap slots to be used for and returned from | 3 | * Manage cache of swap slots to be used for and returned from |
3 | * swap. | 4 | * swap. |
diff --git a/mm/swap_state.c b/mm/swap_state.c index 05b6803f0cce..326439428daf 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/swap_state.c | 3 | * linux/mm/swap_state.c |
3 | * | 4 | * |
diff --git a/mm/swapfile.c b/mm/swapfile.c index bf91dc9e7a79..e47a21e64764 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -2869,6 +2869,7 @@ static struct swap_info_struct *alloc_swap_info(void) | |||
2869 | p->flags = SWP_USED; | 2869 | p->flags = SWP_USED; |
2870 | spin_unlock(&swap_lock); | 2870 | spin_unlock(&swap_lock); |
2871 | spin_lock_init(&p->lock); | 2871 | spin_lock_init(&p->lock); |
2872 | spin_lock_init(&p->cont_lock); | ||
2872 | 2873 | ||
2873 | return p; | 2874 | return p; |
2874 | } | 2875 | } |
@@ -3545,6 +3546,7 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask) | |||
3545 | head = vmalloc_to_page(si->swap_map + offset); | 3546 | head = vmalloc_to_page(si->swap_map + offset); |
3546 | offset &= ~PAGE_MASK; | 3547 | offset &= ~PAGE_MASK; |
3547 | 3548 | ||
3549 | spin_lock(&si->cont_lock); | ||
3548 | /* | 3550 | /* |
3549 | * Page allocation does not initialize the page's lru field, | 3551 | * Page allocation does not initialize the page's lru field, |
3550 | * but it does always reset its private field. | 3552 | * 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) | |||
3564 | * a continuation page, free our allocation and use this one. | 3566 | * a continuation page, free our allocation and use this one. |
3565 | */ | 3567 | */ |
3566 | if (!(count & COUNT_CONTINUED)) | 3568 | if (!(count & COUNT_CONTINUED)) |
3567 | goto out; | 3569 | goto out_unlock_cont; |
3568 | 3570 | ||
3569 | map = kmap_atomic(list_page) + offset; | 3571 | map = kmap_atomic(list_page) + offset; |
3570 | count = *map; | 3572 | count = *map; |
@@ -3575,11 +3577,13 @@ int add_swap_count_continuation(swp_entry_t entry, gfp_t gfp_mask) | |||
3575 | * free our allocation and use this one. | 3577 | * free our allocation and use this one. |
3576 | */ | 3578 | */ |
3577 | if ((count & ~COUNT_CONTINUED) != SWAP_CONT_MAX) | 3579 | if ((count & ~COUNT_CONTINUED) != SWAP_CONT_MAX) |
3578 | goto out; | 3580 | goto out_unlock_cont; |
3579 | } | 3581 | } |
3580 | 3582 | ||
3581 | list_add_tail(&page->lru, &head->lru); | 3583 | list_add_tail(&page->lru, &head->lru); |
3582 | page = NULL; /* now it's attached, don't free it */ | 3584 | page = NULL; /* now it's attached, don't free it */ |
3585 | out_unlock_cont: | ||
3586 | spin_unlock(&si->cont_lock); | ||
3583 | out: | 3587 | out: |
3584 | unlock_cluster(ci); | 3588 | unlock_cluster(ci); |
3585 | spin_unlock(&si->lock); | 3589 | spin_unlock(&si->lock); |
@@ -3604,6 +3608,7 @@ static bool swap_count_continued(struct swap_info_struct *si, | |||
3604 | struct page *head; | 3608 | struct page *head; |
3605 | struct page *page; | 3609 | struct page *page; |
3606 | unsigned char *map; | 3610 | unsigned char *map; |
3611 | bool ret; | ||
3607 | 3612 | ||
3608 | head = vmalloc_to_page(si->swap_map + offset); | 3613 | head = vmalloc_to_page(si->swap_map + offset); |
3609 | if (page_private(head) != SWP_CONTINUED) { | 3614 | if (page_private(head) != SWP_CONTINUED) { |
@@ -3611,6 +3616,7 @@ static bool swap_count_continued(struct swap_info_struct *si, | |||
3611 | return false; /* need to add count continuation */ | 3616 | return false; /* need to add count continuation */ |
3612 | } | 3617 | } |
3613 | 3618 | ||
3619 | spin_lock(&si->cont_lock); | ||
3614 | offset &= ~PAGE_MASK; | 3620 | offset &= ~PAGE_MASK; |
3615 | page = list_entry(head->lru.next, struct page, lru); | 3621 | page = list_entry(head->lru.next, struct page, lru); |
3616 | map = kmap_atomic(page) + offset; | 3622 | map = kmap_atomic(page) + offset; |
@@ -3631,8 +3637,10 @@ static bool swap_count_continued(struct swap_info_struct *si, | |||
3631 | if (*map == SWAP_CONT_MAX) { | 3637 | if (*map == SWAP_CONT_MAX) { |
3632 | kunmap_atomic(map); | 3638 | kunmap_atomic(map); |
3633 | page = list_entry(page->lru.next, struct page, lru); | 3639 | page = list_entry(page->lru.next, struct page, lru); |
3634 | if (page == head) | 3640 | if (page == head) { |
3635 | return false; /* add count continuation */ | 3641 | ret = false; /* add count continuation */ |
3642 | goto out; | ||
3643 | } | ||
3636 | map = kmap_atomic(page) + offset; | 3644 | map = kmap_atomic(page) + offset; |
3637 | init_map: *map = 0; /* we didn't zero the page */ | 3645 | init_map: *map = 0; /* we didn't zero the page */ |
3638 | } | 3646 | } |
@@ -3645,7 +3653,7 @@ init_map: *map = 0; /* we didn't zero the page */ | |||
3645 | kunmap_atomic(map); | 3653 | kunmap_atomic(map); |
3646 | page = list_entry(page->lru.prev, struct page, lru); | 3654 | page = list_entry(page->lru.prev, struct page, lru); |
3647 | } | 3655 | } |
3648 | return true; /* incremented */ | 3656 | ret = true; /* incremented */ |
3649 | 3657 | ||
3650 | } else { /* decrementing */ | 3658 | } else { /* decrementing */ |
3651 | /* | 3659 | /* |
@@ -3671,8 +3679,11 @@ init_map: *map = 0; /* we didn't zero the page */ | |||
3671 | kunmap_atomic(map); | 3679 | kunmap_atomic(map); |
3672 | page = list_entry(page->lru.prev, struct page, lru); | 3680 | page = list_entry(page->lru.prev, struct page, lru); |
3673 | } | 3681 | } |
3674 | return count == COUNT_CONTINUED; | 3682 | ret = count == COUNT_CONTINUED; |
3675 | } | 3683 | } |
3684 | out: | ||
3685 | spin_unlock(&si->cont_lock); | ||
3686 | return ret; | ||
3676 | } | 3687 | } |
3677 | 3688 | ||
3678 | /* | 3689 | /* |
diff --git a/mm/vmacache.c b/mm/vmacache.c index 7ffa0ee341b5..db7596eb6132 100644 --- a/mm/vmacache.c +++ b/mm/vmacache.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Copyright (C) 2014 Davidlohr Bueso. | 3 | * Copyright (C) 2014 Davidlohr Bueso. |
3 | */ | 4 | */ |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 13d711dd8776..eb2f0315b8c0 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * linux/mm/vmscan.c | 3 | * linux/mm/vmscan.c |
3 | * | 4 | * |
diff --git a/mm/workingset.c b/mm/workingset.c index 7119cd745ace..b997c9de28f6 100644 --- a/mm/workingset.c +++ b/mm/workingset.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * Workingset detection | 3 | * Workingset detection |
3 | * | 4 | * |