diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-11-06 15:02:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-11-06 15:02:13 -0500 |
commit | 4dd58158254c8a027f2bf5060b72ef64cafa3b9d (patch) | |
tree | 330fe82fb36a5a50815f156d90b1966e14418c6b | |
parent | 26bc672134241a080a83b2ab9aa8abede8d30e1c (diff) | |
parent | 869712fd3de5a90b7ba23ae1272278cddc66b37b (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge more fixes from Andrew Morton:
"17 fixes"
Mostly mm fixes and one ocfs2 locking fix.
* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
mm: memcontrol: fix network errors from failing __GFP_ATOMIC charges
mm/memory_hotplug: fix updating the node span
scripts/gdb: fix debugging modules compiled with hot/cold partitioning
mm: slab: make page_cgroup_ino() to recognize non-compound slab pages properly
MAINTAINERS: update information for "MEMORY MANAGEMENT"
dump_stack: avoid the livelock of the dump_lock
zswap: add Vitaly to the maintainers list
mm/page_alloc.c: ratelimit allocation failure warnings more aggressively
mm/khugepaged: fix might_sleep() warn with CONFIG_HIGHPTE=y
mm, vmstat: reduce zone->lock holding time by /proc/pagetypeinfo
mm, vmstat: hide /proc/pagetypeinfo from normal users
mm/mmu_notifiers: use the right return code for WARN_ON
ocfs2: protect extent tree in ocfs2_prepare_inode_for_write()
mm: thp: handle page cache THP correctly in PageTransCompoundMap
mm, meminit: recalculate pcpu batch and high limits after init completes
mm/gup_benchmark: fix MAP_HUGETLB case
mm: memcontrol: fix NULL-ptr deref in percpu stats flush
-rw-r--r-- | MAINTAINERS | 5 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 134 | ||||
-rw-r--r-- | include/linux/mm.h | 5 | ||||
-rw-r--r-- | include/linux/mm_types.h | 5 | ||||
-rw-r--r-- | include/linux/page-flags.h | 20 | ||||
-rw-r--r-- | lib/dump_stack.c | 7 | ||||
-rw-r--r-- | mm/khugepaged.c | 7 | ||||
-rw-r--r-- | mm/memcontrol.c | 23 | ||||
-rw-r--r-- | mm/memory_hotplug.c | 8 | ||||
-rw-r--r-- | mm/mmu_notifier.c | 2 | ||||
-rw-r--r-- | mm/page_alloc.c | 17 | ||||
-rw-r--r-- | mm/slab.h | 4 | ||||
-rw-r--r-- | mm/vmstat.c | 25 | ||||
-rw-r--r-- | scripts/gdb/linux/symbols.py | 3 | ||||
-rw-r--r-- | tools/testing/selftests/vm/gup_benchmark.c | 2 |
15 files changed, 188 insertions, 79 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index cba1095547fd..2a427d1e9f01 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -10519,8 +10519,12 @@ F: mm/memblock.c | |||
10519 | F: Documentation/core-api/boot-time-mm.rst | 10519 | F: Documentation/core-api/boot-time-mm.rst |
10520 | 10520 | ||
10521 | MEMORY MANAGEMENT | 10521 | MEMORY MANAGEMENT |
10522 | M: Andrew Morton <akpm@linux-foundation.org> | ||
10522 | L: linux-mm@kvack.org | 10523 | L: linux-mm@kvack.org |
10523 | W: http://www.linux-mm.org | 10524 | W: http://www.linux-mm.org |
10525 | T: quilt https://ozlabs.org/~akpm/mmotm/ | ||
10526 | T: quilt https://ozlabs.org/~akpm/mmots/ | ||
10527 | T: git git://github.com/hnaz/linux-mm.git | ||
10524 | S: Maintained | 10528 | S: Maintained |
10525 | F: include/linux/mm.h | 10529 | F: include/linux/mm.h |
10526 | F: include/linux/gfp.h | 10530 | F: include/linux/gfp.h |
@@ -18034,6 +18038,7 @@ F: Documentation/vm/zsmalloc.rst | |||
18034 | ZSWAP COMPRESSED SWAP CACHING | 18038 | ZSWAP COMPRESSED SWAP CACHING |
18035 | M: Seth Jennings <sjenning@redhat.com> | 18039 | M: Seth Jennings <sjenning@redhat.com> |
18036 | M: Dan Streetman <ddstreet@ieee.org> | 18040 | M: Dan Streetman <ddstreet@ieee.org> |
18041 | M: Vitaly Wool <vitaly.wool@konsulko.com> | ||
18037 | L: linux-mm@kvack.org | 18042 | L: linux-mm@kvack.org |
18038 | S: Maintained | 18043 | S: Maintained |
18039 | F: mm/zswap.c | 18044 | F: mm/zswap.c |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 53939bf9d7d2..9876db52913a 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2098,53 +2098,89 @@ static int ocfs2_is_io_unaligned(struct inode *inode, size_t count, loff_t pos) | |||
2098 | return 0; | 2098 | return 0; |
2099 | } | 2099 | } |
2100 | 2100 | ||
2101 | static int ocfs2_prepare_inode_for_refcount(struct inode *inode, | 2101 | static int ocfs2_inode_lock_for_extent_tree(struct inode *inode, |
2102 | struct file *file, | 2102 | struct buffer_head **di_bh, |
2103 | loff_t pos, size_t count, | 2103 | int meta_level, |
2104 | int *meta_level) | 2104 | int overwrite_io, |
2105 | int write_sem, | ||
2106 | int wait) | ||
2105 | { | 2107 | { |
2106 | int ret; | 2108 | int ret = 0; |
2107 | struct buffer_head *di_bh = NULL; | ||
2108 | u32 cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits; | ||
2109 | u32 clusters = | ||
2110 | ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos; | ||
2111 | 2109 | ||
2112 | ret = ocfs2_inode_lock(inode, &di_bh, 1); | 2110 | if (wait) |
2113 | if (ret) { | 2111 | ret = ocfs2_inode_lock(inode, NULL, meta_level); |
2114 | mlog_errno(ret); | 2112 | else |
2113 | ret = ocfs2_try_inode_lock(inode, | ||
2114 | overwrite_io ? NULL : di_bh, meta_level); | ||
2115 | if (ret < 0) | ||
2115 | goto out; | 2116 | goto out; |
2117 | |||
2118 | if (wait) { | ||
2119 | if (write_sem) | ||
2120 | down_write(&OCFS2_I(inode)->ip_alloc_sem); | ||
2121 | else | ||
2122 | down_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
2123 | } else { | ||
2124 | if (write_sem) | ||
2125 | ret = down_write_trylock(&OCFS2_I(inode)->ip_alloc_sem); | ||
2126 | else | ||
2127 | ret = down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem); | ||
2128 | |||
2129 | if (!ret) { | ||
2130 | ret = -EAGAIN; | ||
2131 | goto out_unlock; | ||
2132 | } | ||
2116 | } | 2133 | } |
2117 | 2134 | ||
2118 | *meta_level = 1; | 2135 | return ret; |
2119 | 2136 | ||
2120 | ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX); | 2137 | out_unlock: |
2121 | if (ret) | 2138 | brelse(*di_bh); |
2122 | mlog_errno(ret); | 2139 | ocfs2_inode_unlock(inode, meta_level); |
2123 | out: | 2140 | out: |
2124 | brelse(di_bh); | ||
2125 | return ret; | 2141 | return ret; |
2126 | } | 2142 | } |
2127 | 2143 | ||
2144 | static void ocfs2_inode_unlock_for_extent_tree(struct inode *inode, | ||
2145 | struct buffer_head **di_bh, | ||
2146 | int meta_level, | ||
2147 | int write_sem) | ||
2148 | { | ||
2149 | if (write_sem) | ||
2150 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | ||
2151 | else | ||
2152 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
2153 | |||
2154 | brelse(*di_bh); | ||
2155 | *di_bh = NULL; | ||
2156 | |||
2157 | if (meta_level >= 0) | ||
2158 | ocfs2_inode_unlock(inode, meta_level); | ||
2159 | } | ||
2160 | |||
2128 | static int ocfs2_prepare_inode_for_write(struct file *file, | 2161 | static int ocfs2_prepare_inode_for_write(struct file *file, |
2129 | loff_t pos, size_t count, int wait) | 2162 | loff_t pos, size_t count, int wait) |
2130 | { | 2163 | { |
2131 | int ret = 0, meta_level = 0, overwrite_io = 0; | 2164 | int ret = 0, meta_level = 0, overwrite_io = 0; |
2165 | int write_sem = 0; | ||
2132 | struct dentry *dentry = file->f_path.dentry; | 2166 | struct dentry *dentry = file->f_path.dentry; |
2133 | struct inode *inode = d_inode(dentry); | 2167 | struct inode *inode = d_inode(dentry); |
2134 | struct buffer_head *di_bh = NULL; | 2168 | struct buffer_head *di_bh = NULL; |
2169 | u32 cpos; | ||
2170 | u32 clusters; | ||
2135 | 2171 | ||
2136 | /* | 2172 | /* |
2137 | * We start with a read level meta lock and only jump to an ex | 2173 | * We start with a read level meta lock and only jump to an ex |
2138 | * if we need to make modifications here. | 2174 | * if we need to make modifications here. |
2139 | */ | 2175 | */ |
2140 | for(;;) { | 2176 | for(;;) { |
2141 | if (wait) | 2177 | ret = ocfs2_inode_lock_for_extent_tree(inode, |
2142 | ret = ocfs2_inode_lock(inode, NULL, meta_level); | 2178 | &di_bh, |
2143 | else | 2179 | meta_level, |
2144 | ret = ocfs2_try_inode_lock(inode, | 2180 | overwrite_io, |
2145 | overwrite_io ? NULL : &di_bh, meta_level); | 2181 | write_sem, |
2182 | wait); | ||
2146 | if (ret < 0) { | 2183 | if (ret < 0) { |
2147 | meta_level = -1; | ||
2148 | if (ret != -EAGAIN) | 2184 | if (ret != -EAGAIN) |
2149 | mlog_errno(ret); | 2185 | mlog_errno(ret); |
2150 | goto out; | 2186 | goto out; |
@@ -2156,15 +2192,8 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2156 | */ | 2192 | */ |
2157 | if (!wait && !overwrite_io) { | 2193 | if (!wait && !overwrite_io) { |
2158 | overwrite_io = 1; | 2194 | overwrite_io = 1; |
2159 | if (!down_read_trylock(&OCFS2_I(inode)->ip_alloc_sem)) { | ||
2160 | ret = -EAGAIN; | ||
2161 | goto out_unlock; | ||
2162 | } | ||
2163 | 2195 | ||
2164 | ret = ocfs2_overwrite_io(inode, di_bh, pos, count); | 2196 | ret = ocfs2_overwrite_io(inode, di_bh, pos, count); |
2165 | brelse(di_bh); | ||
2166 | di_bh = NULL; | ||
2167 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | ||
2168 | if (ret < 0) { | 2197 | if (ret < 0) { |
2169 | if (ret != -EAGAIN) | 2198 | if (ret != -EAGAIN) |
2170 | mlog_errno(ret); | 2199 | mlog_errno(ret); |
@@ -2183,7 +2212,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2183 | * set inode->i_size at the end of a write. */ | 2212 | * set inode->i_size at the end of a write. */ |
2184 | if (should_remove_suid(dentry)) { | 2213 | if (should_remove_suid(dentry)) { |
2185 | if (meta_level == 0) { | 2214 | if (meta_level == 0) { |
2186 | ocfs2_inode_unlock(inode, meta_level); | 2215 | ocfs2_inode_unlock_for_extent_tree(inode, |
2216 | &di_bh, | ||
2217 | meta_level, | ||
2218 | write_sem); | ||
2187 | meta_level = 1; | 2219 | meta_level = 1; |
2188 | continue; | 2220 | continue; |
2189 | } | 2221 | } |
@@ -2197,18 +2229,32 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2197 | 2229 | ||
2198 | ret = ocfs2_check_range_for_refcount(inode, pos, count); | 2230 | ret = ocfs2_check_range_for_refcount(inode, pos, count); |
2199 | if (ret == 1) { | 2231 | if (ret == 1) { |
2200 | ocfs2_inode_unlock(inode, meta_level); | 2232 | ocfs2_inode_unlock_for_extent_tree(inode, |
2201 | meta_level = -1; | 2233 | &di_bh, |
2202 | 2234 | meta_level, | |
2203 | ret = ocfs2_prepare_inode_for_refcount(inode, | 2235 | write_sem); |
2204 | file, | 2236 | ret = ocfs2_inode_lock_for_extent_tree(inode, |
2205 | pos, | 2237 | &di_bh, |
2206 | count, | 2238 | meta_level, |
2207 | &meta_level); | 2239 | overwrite_io, |
2240 | 1, | ||
2241 | wait); | ||
2242 | write_sem = 1; | ||
2243 | if (ret < 0) { | ||
2244 | if (ret != -EAGAIN) | ||
2245 | mlog_errno(ret); | ||
2246 | goto out; | ||
2247 | } | ||
2248 | |||
2249 | cpos = pos >> OCFS2_SB(inode->i_sb)->s_clustersize_bits; | ||
2250 | clusters = | ||
2251 | ocfs2_clusters_for_bytes(inode->i_sb, pos + count) - cpos; | ||
2252 | ret = ocfs2_refcount_cow(inode, di_bh, cpos, clusters, UINT_MAX); | ||
2208 | } | 2253 | } |
2209 | 2254 | ||
2210 | if (ret < 0) { | 2255 | if (ret < 0) { |
2211 | mlog_errno(ret); | 2256 | if (ret != -EAGAIN) |
2257 | mlog_errno(ret); | ||
2212 | goto out_unlock; | 2258 | goto out_unlock; |
2213 | } | 2259 | } |
2214 | 2260 | ||
@@ -2219,10 +2265,10 @@ out_unlock: | |||
2219 | trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno, | 2265 | trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno, |
2220 | pos, count, wait); | 2266 | pos, count, wait); |
2221 | 2267 | ||
2222 | brelse(di_bh); | 2268 | ocfs2_inode_unlock_for_extent_tree(inode, |
2223 | 2269 | &di_bh, | |
2224 | if (meta_level >= 0) | 2270 | meta_level, |
2225 | ocfs2_inode_unlock(inode, meta_level); | 2271 | write_sem); |
2226 | 2272 | ||
2227 | out: | 2273 | out: |
2228 | return ret; | 2274 | return ret; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index cc292273e6ba..a2adf95b3f9c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -695,11 +695,6 @@ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) | |||
695 | 695 | ||
696 | extern void kvfree(const void *addr); | 696 | extern void kvfree(const void *addr); |
697 | 697 | ||
698 | static inline atomic_t *compound_mapcount_ptr(struct page *page) | ||
699 | { | ||
700 | return &page[1].compound_mapcount; | ||
701 | } | ||
702 | |||
703 | static inline int compound_mapcount(struct page *page) | 698 | static inline int compound_mapcount(struct page *page) |
704 | { | 699 | { |
705 | VM_BUG_ON_PAGE(!PageCompound(page), page); | 700 | VM_BUG_ON_PAGE(!PageCompound(page), page); |
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 2222fa795284..270aa8fd2800 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -221,6 +221,11 @@ struct page { | |||
221 | #endif | 221 | #endif |
222 | } _struct_page_alignment; | 222 | } _struct_page_alignment; |
223 | 223 | ||
224 | static inline atomic_t *compound_mapcount_ptr(struct page *page) | ||
225 | { | ||
226 | return &page[1].compound_mapcount; | ||
227 | } | ||
228 | |||
224 | /* | 229 | /* |
225 | * Used for sizing the vmemmap region on some architectures | 230 | * Used for sizing the vmemmap region on some architectures |
226 | */ | 231 | */ |
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f91cb8898ff0..1bf83c8fcaa7 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -622,12 +622,28 @@ static inline int PageTransCompound(struct page *page) | |||
622 | * | 622 | * |
623 | * Unlike PageTransCompound, this is safe to be called only while | 623 | * Unlike PageTransCompound, this is safe to be called only while |
624 | * split_huge_pmd() cannot run from under us, like if protected by the | 624 | * split_huge_pmd() cannot run from under us, like if protected by the |
625 | * MMU notifier, otherwise it may result in page->_mapcount < 0 false | 625 | * MMU notifier, otherwise it may result in page->_mapcount check false |
626 | * positives. | 626 | * positives. |
627 | * | ||
628 | * We have to treat page cache THP differently since every subpage of it | ||
629 | * would get _mapcount inc'ed once it is PMD mapped. But, it may be PTE | ||
630 | * mapped in the current process so comparing subpage's _mapcount to | ||
631 | * compound_mapcount to filter out PTE mapped case. | ||
627 | */ | 632 | */ |
628 | static inline int PageTransCompoundMap(struct page *page) | 633 | static inline int PageTransCompoundMap(struct page *page) |
629 | { | 634 | { |
630 | return PageTransCompound(page) && atomic_read(&page->_mapcount) < 0; | 635 | struct page *head; |
636 | |||
637 | if (!PageTransCompound(page)) | ||
638 | return 0; | ||
639 | |||
640 | if (PageAnon(page)) | ||
641 | return atomic_read(&page->_mapcount) < 0; | ||
642 | |||
643 | head = compound_head(page); | ||
644 | /* File THP is PMD mapped and not PTE mapped */ | ||
645 | return atomic_read(&page->_mapcount) == | ||
646 | atomic_read(compound_mapcount_ptr(head)); | ||
631 | } | 647 | } |
632 | 648 | ||
633 | /* | 649 | /* |
diff --git a/lib/dump_stack.c b/lib/dump_stack.c index 5cff72f18c4a..33ffbf308853 100644 --- a/lib/dump_stack.c +++ b/lib/dump_stack.c | |||
@@ -106,7 +106,12 @@ retry: | |||
106 | was_locked = 1; | 106 | was_locked = 1; |
107 | } else { | 107 | } else { |
108 | local_irq_restore(flags); | 108 | local_irq_restore(flags); |
109 | cpu_relax(); | 109 | /* |
110 | * Wait for the lock to release before jumping to | ||
111 | * atomic_cmpxchg() in order to mitigate the thundering herd | ||
112 | * problem. | ||
113 | */ | ||
114 | do { cpu_relax(); } while (atomic_read(&dump_lock) != -1); | ||
110 | goto retry; | 115 | goto retry; |
111 | } | 116 | } |
112 | 117 | ||
diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 0a1b4b484ac5..f05d27b7183d 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c | |||
@@ -1028,12 +1028,13 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
1028 | 1028 | ||
1029 | anon_vma_lock_write(vma->anon_vma); | 1029 | anon_vma_lock_write(vma->anon_vma); |
1030 | 1030 | ||
1031 | pte = pte_offset_map(pmd, address); | ||
1032 | pte_ptl = pte_lockptr(mm, pmd); | ||
1033 | |||
1034 | mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm, | 1031 | mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm, |
1035 | address, address + HPAGE_PMD_SIZE); | 1032 | address, address + HPAGE_PMD_SIZE); |
1036 | mmu_notifier_invalidate_range_start(&range); | 1033 | mmu_notifier_invalidate_range_start(&range); |
1034 | |||
1035 | pte = pte_offset_map(pmd, address); | ||
1036 | pte_ptl = pte_lockptr(mm, pmd); | ||
1037 | |||
1037 | pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */ | 1038 | pmd_ptl = pmd_lock(mm, pmd); /* probably unnecessary */ |
1038 | /* | 1039 | /* |
1039 | * After this gup_fast can't run anymore. This also removes | 1040 | * After this gup_fast can't run anymore. This also removes |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 363106578876..37592dd7ae32 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -484,7 +484,7 @@ ino_t page_cgroup_ino(struct page *page) | |||
484 | unsigned long ino = 0; | 484 | unsigned long ino = 0; |
485 | 485 | ||
486 | rcu_read_lock(); | 486 | rcu_read_lock(); |
487 | if (PageHead(page) && PageSlab(page)) | 487 | if (PageSlab(page) && !PageTail(page)) |
488 | memcg = memcg_from_slab_page(page); | 488 | memcg = memcg_from_slab_page(page); |
489 | else | 489 | else |
490 | memcg = READ_ONCE(page->mem_cgroup); | 490 | memcg = READ_ONCE(page->mem_cgroup); |
@@ -2535,6 +2535,15 @@ retry: | |||
2535 | } | 2535 | } |
2536 | 2536 | ||
2537 | /* | 2537 | /* |
2538 | * Memcg doesn't have a dedicated reserve for atomic | ||
2539 | * allocations. But like the global atomic pool, we need to | ||
2540 | * put the burden of reclaim on regular allocation requests | ||
2541 | * and let these go through as privileged allocations. | ||
2542 | */ | ||
2543 | if (gfp_mask & __GFP_ATOMIC) | ||
2544 | goto force; | ||
2545 | |||
2546 | /* | ||
2538 | * Unlike in global OOM situations, memcg is not in a physical | 2547 | * Unlike in global OOM situations, memcg is not in a physical |
2539 | * memory shortage. Allow dying and OOM-killed tasks to | 2548 | * memory shortage. Allow dying and OOM-killed tasks to |
2540 | * bypass the last charges so that they can exit quickly and | 2549 | * bypass the last charges so that they can exit quickly and |
@@ -5014,12 +5023,6 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg) | |||
5014 | { | 5023 | { |
5015 | int node; | 5024 | int node; |
5016 | 5025 | ||
5017 | /* | ||
5018 | * Flush percpu vmstats and vmevents to guarantee the value correctness | ||
5019 | * on parent's and all ancestor levels. | ||
5020 | */ | ||
5021 | memcg_flush_percpu_vmstats(memcg, false); | ||
5022 | memcg_flush_percpu_vmevents(memcg); | ||
5023 | for_each_node(node) | 5026 | for_each_node(node) |
5024 | free_mem_cgroup_per_node_info(memcg, node); | 5027 | free_mem_cgroup_per_node_info(memcg, node); |
5025 | free_percpu(memcg->vmstats_percpu); | 5028 | free_percpu(memcg->vmstats_percpu); |
@@ -5030,6 +5033,12 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg) | |||
5030 | static void mem_cgroup_free(struct mem_cgroup *memcg) | 5033 | static void mem_cgroup_free(struct mem_cgroup *memcg) |
5031 | { | 5034 | { |
5032 | memcg_wb_domain_exit(memcg); | 5035 | memcg_wb_domain_exit(memcg); |
5036 | /* | ||
5037 | * Flush percpu vmstats and vmevents to guarantee the value correctness | ||
5038 | * on parent's and all ancestor levels. | ||
5039 | */ | ||
5040 | memcg_flush_percpu_vmstats(memcg, false); | ||
5041 | memcg_flush_percpu_vmevents(memcg); | ||
5033 | __mem_cgroup_free(memcg); | 5042 | __mem_cgroup_free(memcg); |
5034 | } | 5043 | } |
5035 | 5044 | ||
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index df570e5c71cc..07e5c67f48a8 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -447,6 +447,14 @@ static void update_pgdat_span(struct pglist_data *pgdat) | |||
447 | zone->spanned_pages; | 447 | zone->spanned_pages; |
448 | 448 | ||
449 | /* No need to lock the zones, they can't change. */ | 449 | /* No need to lock the zones, they can't change. */ |
450 | if (!zone->spanned_pages) | ||
451 | continue; | ||
452 | if (!node_end_pfn) { | ||
453 | node_start_pfn = zone->zone_start_pfn; | ||
454 | node_end_pfn = zone_end_pfn; | ||
455 | continue; | ||
456 | } | ||
457 | |||
450 | if (zone_end_pfn > node_end_pfn) | 458 | if (zone_end_pfn > node_end_pfn) |
451 | node_end_pfn = zone_end_pfn; | 459 | node_end_pfn = zone_end_pfn; |
452 | if (zone->zone_start_pfn < node_start_pfn) | 460 | if (zone->zone_start_pfn < node_start_pfn) |
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c index 7fde88695f35..9a889e456168 100644 --- a/mm/mmu_notifier.c +++ b/mm/mmu_notifier.c | |||
@@ -180,7 +180,7 @@ int __mmu_notifier_invalidate_range_start(struct mmu_notifier_range *range) | |||
180 | mn->ops->invalidate_range_start, _ret, | 180 | mn->ops->invalidate_range_start, _ret, |
181 | !mmu_notifier_range_blockable(range) ? "non-" : ""); | 181 | !mmu_notifier_range_blockable(range) ? "non-" : ""); |
182 | WARN_ON(mmu_notifier_range_blockable(range) || | 182 | WARN_ON(mmu_notifier_range_blockable(range) || |
183 | ret != -EAGAIN); | 183 | _ret != -EAGAIN); |
184 | ret = _ret; | 184 | ret = _ret; |
185 | } | 185 | } |
186 | } | 186 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ecc3dbad606b..f391c0c4ed1d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1948,6 +1948,14 @@ void __init page_alloc_init_late(void) | |||
1948 | wait_for_completion(&pgdat_init_all_done_comp); | 1948 | wait_for_completion(&pgdat_init_all_done_comp); |
1949 | 1949 | ||
1950 | /* | 1950 | /* |
1951 | * The number of managed pages has changed due to the initialisation | ||
1952 | * so the pcpu batch and high limits needs to be updated or the limits | ||
1953 | * will be artificially small. | ||
1954 | */ | ||
1955 | for_each_populated_zone(zone) | ||
1956 | zone_pcp_update(zone); | ||
1957 | |||
1958 | /* | ||
1951 | * We initialized the rest of the deferred pages. Permanently disable | 1959 | * We initialized the rest of the deferred pages. Permanently disable |
1952 | * on-demand struct page initialization. | 1960 | * on-demand struct page initialization. |
1953 | */ | 1961 | */ |
@@ -3720,10 +3728,6 @@ try_this_zone: | |||
3720 | static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask) | 3728 | static void warn_alloc_show_mem(gfp_t gfp_mask, nodemask_t *nodemask) |
3721 | { | 3729 | { |
3722 | unsigned int filter = SHOW_MEM_FILTER_NODES; | 3730 | unsigned int filter = SHOW_MEM_FILTER_NODES; |
3723 | static DEFINE_RATELIMIT_STATE(show_mem_rs, HZ, 1); | ||
3724 | |||
3725 | if (!__ratelimit(&show_mem_rs)) | ||
3726 | return; | ||
3727 | 3731 | ||
3728 | /* | 3732 | /* |
3729 | * This documents exceptions given to allocations in certain | 3733 | * This documents exceptions given to allocations in certain |
@@ -3744,8 +3748,7 @@ void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...) | |||
3744 | { | 3748 | { |
3745 | struct va_format vaf; | 3749 | struct va_format vaf; |
3746 | va_list args; | 3750 | va_list args; |
3747 | static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL, | 3751 | static DEFINE_RATELIMIT_STATE(nopage_rs, 10*HZ, 1); |
3748 | DEFAULT_RATELIMIT_BURST); | ||
3749 | 3752 | ||
3750 | if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) | 3753 | if ((gfp_mask & __GFP_NOWARN) || !__ratelimit(&nopage_rs)) |
3751 | return; | 3754 | return; |
@@ -8514,7 +8517,6 @@ void free_contig_range(unsigned long pfn, unsigned int nr_pages) | |||
8514 | WARN(count != 0, "%d pages are still in use!\n", count); | 8517 | WARN(count != 0, "%d pages are still in use!\n", count); |
8515 | } | 8518 | } |
8516 | 8519 | ||
8517 | #ifdef CONFIG_MEMORY_HOTPLUG | ||
8518 | /* | 8520 | /* |
8519 | * The zone indicated has a new number of managed_pages; batch sizes and percpu | 8521 | * The zone indicated has a new number of managed_pages; batch sizes and percpu |
8520 | * page high values need to be recalulated. | 8522 | * page high values need to be recalulated. |
@@ -8528,7 +8530,6 @@ void __meminit zone_pcp_update(struct zone *zone) | |||
8528 | per_cpu_ptr(zone->pageset, cpu)); | 8530 | per_cpu_ptr(zone->pageset, cpu)); |
8529 | mutex_unlock(&pcp_batch_high_lock); | 8531 | mutex_unlock(&pcp_batch_high_lock); |
8530 | } | 8532 | } |
8531 | #endif | ||
8532 | 8533 | ||
8533 | void zone_pcp_reset(struct zone *zone) | 8534 | void zone_pcp_reset(struct zone *zone) |
8534 | { | 8535 | { |
@@ -323,8 +323,8 @@ static inline struct kmem_cache *memcg_root_cache(struct kmem_cache *s) | |||
323 | * Expects a pointer to a slab page. Please note, that PageSlab() check | 323 | * Expects a pointer to a slab page. Please note, that PageSlab() check |
324 | * isn't sufficient, as it returns true also for tail compound slab pages, | 324 | * isn't sufficient, as it returns true also for tail compound slab pages, |
325 | * which do not have slab_cache pointer set. | 325 | * which do not have slab_cache pointer set. |
326 | * So this function assumes that the page can pass PageHead() and PageSlab() | 326 | * So this function assumes that the page can pass PageSlab() && !PageTail() |
327 | * checks. | 327 | * check. |
328 | * | 328 | * |
329 | * The kmem_cache can be reparented asynchronously. The caller must ensure | 329 | * The kmem_cache can be reparented asynchronously. The caller must ensure |
330 | * the memcg lifetime, e.g. by taking rcu_read_lock() or cgroup_mutex. | 330 | * the memcg lifetime, e.g. by taking rcu_read_lock() or cgroup_mutex. |
diff --git a/mm/vmstat.c b/mm/vmstat.c index 6afc892a148a..a8222041bd44 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c | |||
@@ -1383,12 +1383,29 @@ static void pagetypeinfo_showfree_print(struct seq_file *m, | |||
1383 | unsigned long freecount = 0; | 1383 | unsigned long freecount = 0; |
1384 | struct free_area *area; | 1384 | struct free_area *area; |
1385 | struct list_head *curr; | 1385 | struct list_head *curr; |
1386 | bool overflow = false; | ||
1386 | 1387 | ||
1387 | area = &(zone->free_area[order]); | 1388 | area = &(zone->free_area[order]); |
1388 | 1389 | ||
1389 | list_for_each(curr, &area->free_list[mtype]) | 1390 | list_for_each(curr, &area->free_list[mtype]) { |
1390 | freecount++; | 1391 | /* |
1391 | seq_printf(m, "%6lu ", freecount); | 1392 | * Cap the free_list iteration because it might |
1393 | * be really large and we are under a spinlock | ||
1394 | * so a long time spent here could trigger a | ||
1395 | * hard lockup detector. Anyway this is a | ||
1396 | * debugging tool so knowing there is a handful | ||
1397 | * of pages of this order should be more than | ||
1398 | * sufficient. | ||
1399 | */ | ||
1400 | if (++freecount >= 100000) { | ||
1401 | overflow = true; | ||
1402 | break; | ||
1403 | } | ||
1404 | } | ||
1405 | seq_printf(m, "%s%6lu ", overflow ? ">" : "", freecount); | ||
1406 | spin_unlock_irq(&zone->lock); | ||
1407 | cond_resched(); | ||
1408 | spin_lock_irq(&zone->lock); | ||
1392 | } | 1409 | } |
1393 | seq_putc(m, '\n'); | 1410 | seq_putc(m, '\n'); |
1394 | } | 1411 | } |
@@ -1972,7 +1989,7 @@ void __init init_mm_internals(void) | |||
1972 | #endif | 1989 | #endif |
1973 | #ifdef CONFIG_PROC_FS | 1990 | #ifdef CONFIG_PROC_FS |
1974 | proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op); | 1991 | proc_create_seq("buddyinfo", 0444, NULL, &fragmentation_op); |
1975 | proc_create_seq("pagetypeinfo", 0444, NULL, &pagetypeinfo_op); | 1992 | proc_create_seq("pagetypeinfo", 0400, NULL, &pagetypeinfo_op); |
1976 | proc_create_seq("vmstat", 0444, NULL, &vmstat_op); | 1993 | proc_create_seq("vmstat", 0444, NULL, &vmstat_op); |
1977 | proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); | 1994 | proc_create_seq("zoneinfo", 0444, NULL, &zoneinfo_op); |
1978 | #endif | 1995 | #endif |
diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index 7b7c2fafbc68..be984aa29b75 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py | |||
@@ -99,7 +99,8 @@ lx-symbols command.""" | |||
99 | attrs[n]['name'].string(): attrs[n]['address'] | 99 | attrs[n]['name'].string(): attrs[n]['address'] |
100 | for n in range(int(sect_attrs['nsections']))} | 100 | for n in range(int(sect_attrs['nsections']))} |
101 | args = [] | 101 | args = [] |
102 | for section_name in [".data", ".data..read_mostly", ".rodata", ".bss"]: | 102 | for section_name in [".data", ".data..read_mostly", ".rodata", ".bss", |
103 | ".text", ".text.hot", ".text.unlikely"]: | ||
103 | address = section_name_to_address.get(section_name) | 104 | address = section_name_to_address.get(section_name) |
104 | if address: | 105 | if address: |
105 | args.append(" -s {name} {addr}".format( | 106 | args.append(" -s {name} {addr}".format( |
diff --git a/tools/testing/selftests/vm/gup_benchmark.c b/tools/testing/selftests/vm/gup_benchmark.c index cb3fc09645c4..485cf06ef013 100644 --- a/tools/testing/selftests/vm/gup_benchmark.c +++ b/tools/testing/selftests/vm/gup_benchmark.c | |||
@@ -71,7 +71,7 @@ int main(int argc, char **argv) | |||
71 | flags |= MAP_SHARED; | 71 | flags |= MAP_SHARED; |
72 | break; | 72 | break; |
73 | case 'H': | 73 | case 'H': |
74 | flags |= MAP_HUGETLB; | 74 | flags |= (MAP_HUGETLB | MAP_ANONYMOUS); |
75 | break; | 75 | break; |
76 | default: | 76 | default: |
77 | return -1; | 77 | return -1; |