tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/next/linux-next.git master head: 22c45ec32b4a9fa8c48ef4f5bf9b189b307aae12 commit: 8236f517d69e2217f5200d7f700e8b18b01c94c8 [12342/12641] mm: shrinker: make shrinker not depend on memcg kmem config: x86_64-randconfig-s2-07051907 (attached as .config) compiler: gcc-7 (Debian 7.4.0-9) 7.4.0 reproduce: git checkout 8236f517d69e2217f5200d7f700e8b18b01c94c8 # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> All error/warnings (new ones prefixed by >>): mm/vmscan.c: In function 'prealloc_memcg_shrinker': >> mm/vmscan.c:205:7: error: implicit declaration of function 'memcg_expand_shrinker_maps'; did you mean 'memcg_set_shrinker_bit'? [-Werror=implicit-function-declaration] if (memcg_expand_shrinker_maps(id)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ memcg_set_shrinker_bit In file included from include/linux/rbtree.h:22:0, from include/linux/mm_types.h:10, from include/linux/mmzone.h:21, from include/linux/gfp.h:6, from include/linux/mm.h:10, from mm/vmscan.c:17: mm/vmscan.c: In function 'shrink_slab_memcg': >> mm/vmscan.c:593:54: error: 'struct mem_cgroup_per_node' has no member named 'shrinker_map' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, ^ include/linux/rcupdate.h:321:12: note: in definition of macro '__rcu_dereference_protected' ((typeof(*p) __force __kernel *)(p)); \ ^ >> mm/vmscan.c:593:8: note: in expansion of macro 'rcu_dereference_protected' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, ^~~~~~~~~~~~~~~~~~~~~~~~~ >> mm/vmscan.c:593:54: error: 'struct mem_cgroup_per_node' has no member named 'shrinker_map' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, ^ include/linux/rcupdate.h:321:35: note: in definition of macro '__rcu_dereference_protected' ((typeof(*p) __force __kernel *)(p)); \ ^ >> mm/vmscan.c:593:8: note: in expansion of macro 'rcu_dereference_protected' map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, ^~~~~~~~~~~~~~~~~~~~~~~~~ cc1: some warnings being treated as errors vim +205 mm/vmscan.c b1de0d139 Mitchel Humpherys 2014-06-06 16 ^1da177e4 Linus Torvalds 2005-04-16 @17 #include <linux/mm.h> 5b3cc15af Ingo Molnar 2017-02-02 18 #include <linux/sched/mm.h> ^1da177e4 Linus Torvalds 2005-04-16 19 #include <linux/module.h> 5a0e3ad6a Tejun Heo 2010-03-24 20 #include <linux/gfp.h> ^1da177e4 Linus Torvalds 2005-04-16 21 #include <linux/kernel_stat.h> ^1da177e4 Linus Torvalds 2005-04-16 22 #include <linux/swap.h> ^1da177e4 Linus Torvalds 2005-04-16 23 #include <linux/pagemap.h> ^1da177e4 Linus Torvalds 2005-04-16 24 #include <linux/init.h> ^1da177e4 Linus Torvalds 2005-04-16 25 #include <linux/highmem.h> 70ddf637e Anton Vorontsov 2013-04-29 26 #include <linux/vmpressure.h> e129b5c23 Andrew Morton 2006-09-27 27 #include <linux/vmstat.h> ^1da177e4 Linus Torvalds 2005-04-16 28 #include <linux/file.h> ^1da177e4 Linus Torvalds 2005-04-16 29 #include <linux/writeback.h> ^1da177e4 Linus Torvalds 2005-04-16 30 #include <linux/blkdev.h> ^1da177e4 Linus Torvalds 2005-04-16 31 #include <linux/buffer_head.h> /* for try_to_release_page(), ^1da177e4 Linus Torvalds 2005-04-16 32 buffer_heads_over_limit */ ^1da177e4 Linus Torvalds 2005-04-16 33 #include <linux/mm_inline.h> ^1da177e4 Linus Torvalds 2005-04-16 34 #include <linux/backing-dev.h> ^1da177e4 Linus Torvalds 2005-04-16 35 #include <linux/rmap.h> ^1da177e4 Linus Torvalds 2005-04-16 36 #include <linux/topology.h> ^1da177e4 Linus Torvalds 2005-04-16 37 #include <linux/cpu.h> ^1da177e4 Linus Torvalds 2005-04-16 38 #include <linux/cpuset.h> 3e7d34497 Mel Gorman 2011-01-13 39 #include <linux/compaction.h> ^1da177e4 Linus Torvalds 2005-04-16 40 #include <linux/notifier.h> ^1da177e4 Linus Torvalds 2005-04-16 41 #include <linux/rwsem.h> 248a0301e Rafael J. Wysocki 2006-03-22 42 #include <linux/delay.h> 3218ae14b Yasunori Goto 2006-06-27 43 #include <linux/kthread.h> 7dfb71030 Nigel Cunningham 2006-12-06 44 #include <linux/freezer.h> 66e1707bc Balbir Singh 2008-02-07 45 #include <linux/memcontrol.h> 873b47717 Keika Kobayashi 2008-07-25 46 #include <linux/delayacct.h> af936a160 Lee Schermerhorn 2008-10-18 47 #include <linux/sysctl.h> 929bea7c7 KOSAKI Motohiro 2011-04-14 48 #include <linux/oom.h> 64e3d12f7 Kuo-Hsin Yang 2018-11-06 49 #include <linux/pagevec.h> 268bb0ce3 Linus Torvalds 2011-05-20 50 #include <linux/prefetch.h> b1de0d139 Mitchel Humpherys 2014-06-06 51 #include <linux/printk.h> f9fe48bec Ross Zwisler 2016-01-22 52 #include <linux/dax.h> eb414681d Johannes Weiner 2018-10-26 53 #include <linux/psi.h> ^1da177e4 Linus Torvalds 2005-04-16 54 ^1da177e4 Linus Torvalds 2005-04-16 55 #include <asm/tlbflush.h> ^1da177e4 Linus Torvalds 2005-04-16 56 #include <asm/div64.h> ^1da177e4 Linus Torvalds 2005-04-16 57 ^1da177e4 Linus Torvalds 2005-04-16 58 #include <linux/swapops.h> 117aad1e9 Rafael Aquini 2013-09-30 59 #include <linux/balloon_compaction.h> ^1da177e4 Linus Torvalds 2005-04-16 60 0f8053a50 Nick Piggin 2006-03-22 61 #include "internal.h" 0f8053a50 Nick Piggin 2006-03-22 62 33906bc5c Mel Gorman 2010-08-09 63 #define CREATE_TRACE_POINTS 33906bc5c Mel Gorman 2010-08-09 64 #include <trace/events/vmscan.h> 33906bc5c Mel Gorman 2010-08-09 65 ^1da177e4 Linus Torvalds 2005-04-16 66 struct scan_control { 22fba3354 KOSAKI Motohiro 2009-12-14 67 /* How many pages shrink_list() should reclaim */ 22fba3354 KOSAKI Motohiro 2009-12-14 68 unsigned long nr_to_reclaim; 22fba3354 KOSAKI Motohiro 2009-12-14 69 ee814fe23 Johannes Weiner 2014-08-06 70 /* ee814fe23 Johannes Weiner 2014-08-06 71 * Nodemask of nodes allowed by the caller. If NULL, all nodes ee814fe23 Johannes Weiner 2014-08-06 72 * are scanned. ee814fe23 Johannes Weiner 2014-08-06 73 */ ee814fe23 Johannes Weiner 2014-08-06 74 nodemask_t *nodemask; 9e3b2f8cd Konstantin Khlebnikov 2012-05-29 75 5f53e7629 KOSAKI Motohiro 2010-05-24 76 /* f16015fbf Johannes Weiner 2012-01-12 77 * The memory cgroup that hit its limit and as a result is the f16015fbf Johannes Weiner 2012-01-12 78 * primary target of this reclaim invocation. f16015fbf Johannes Weiner 2012-01-12 79 */ f16015fbf Johannes Weiner 2012-01-12 80 struct mem_cgroup *target_mem_cgroup; 66e1707bc Balbir Singh 2008-02-07 81 1276ad68e Johannes Weiner 2017-02-24 82 /* Writepage batching in laptop mode; RECLAIM_WRITE */ ee814fe23 Johannes Weiner 2014-08-06 83 unsigned int may_writepage:1; ee814fe23 Johannes Weiner 2014-08-06 84 ee814fe23 Johannes Weiner 2014-08-06 85 /* Can mapped pages be reclaimed? */ ee814fe23 Johannes Weiner 2014-08-06 86 unsigned int may_unmap:1; ee814fe23 Johannes Weiner 2014-08-06 87 ee814fe23 Johannes Weiner 2014-08-06 88 /* Can pages be swapped as part of reclaim? */ ee814fe23 Johannes Weiner 2014-08-06 89 unsigned int may_swap:1; ee814fe23 Johannes Weiner 2014-08-06 90 1c30844d2 Mel Gorman 2018-12-28 91 /* e.g. boosted watermark reclaim leaves slabs alone */ 1c30844d2 Mel Gorman 2018-12-28 92 unsigned int may_shrinkslab:1; 1c30844d2 Mel Gorman 2018-12-28 93 d6622f636 Yisheng Xie 2017-05-03 94 /* d6622f636 Yisheng Xie 2017-05-03 95 * Cgroups are not reclaimed below their configured memory.low, d6622f636 Yisheng Xie 2017-05-03 96 * unless we threaten to OOM. If any cgroups are skipped due to d6622f636 Yisheng Xie 2017-05-03 97 * memory.low and nothing was reclaimed, go back for memory.low. d6622f636 Yisheng Xie 2017-05-03 98 */ d6622f636 Yisheng Xie 2017-05-03 99 unsigned int memcg_low_reclaim:1; d6622f636 Yisheng Xie 2017-05-03 100 unsigned int memcg_low_skipped:1; 241994ed8 Johannes Weiner 2015-02-11 101 ee814fe23 Johannes Weiner 2014-08-06 102 unsigned int hibernation_mode:1; ee814fe23 Johannes Weiner 2014-08-06 103 ee814fe23 Johannes Weiner 2014-08-06 104 /* One of the zones is ready for compaction */ ee814fe23 Johannes Weiner 2014-08-06 105 unsigned int compaction_ready:1; ee814fe23 Johannes Weiner 2014-08-06 106 bb451fdf3 Greg Thelen 2018-08-17 107 /* Allocation order */ bb451fdf3 Greg Thelen 2018-08-17 108 s8 order; bb451fdf3 Greg Thelen 2018-08-17 109 bb451fdf3 Greg Thelen 2018-08-17 110 /* Scan (total_size >> priority) pages at once */ bb451fdf3 Greg Thelen 2018-08-17 111 s8 priority; bb451fdf3 Greg Thelen 2018-08-17 112 bb451fdf3 Greg Thelen 2018-08-17 113 /* The highest zone to isolate pages for reclaim from */ bb451fdf3 Greg Thelen 2018-08-17 114 s8 reclaim_idx; bb451fdf3 Greg Thelen 2018-08-17 115 bb451fdf3 Greg Thelen 2018-08-17 116 /* This context's GFP mask */ bb451fdf3 Greg Thelen 2018-08-17 117 gfp_t gfp_mask; bb451fdf3 Greg Thelen 2018-08-17 118 ee814fe23 Johannes Weiner 2014-08-06 119 /* Incremented by the number of inactive pages that were scanned */ ee814fe23 Johannes Weiner 2014-08-06 120 unsigned long nr_scanned; ee814fe23 Johannes Weiner 2014-08-06 121 ee814fe23 Johannes Weiner 2014-08-06 122 /* Number of pages freed so far during a call to shrink_zones() */ ee814fe23 Johannes Weiner 2014-08-06 123 unsigned long nr_reclaimed; d108c7721 Andrey Ryabinin 2018-04-10 124 d108c7721 Andrey Ryabinin 2018-04-10 125 struct { d108c7721 Andrey Ryabinin 2018-04-10 126 unsigned int dirty; d108c7721 Andrey Ryabinin 2018-04-10 127 unsigned int unqueued_dirty; d108c7721 Andrey Ryabinin 2018-04-10 128 unsigned int congested; d108c7721 Andrey Ryabinin 2018-04-10 129 unsigned int writeback; d108c7721 Andrey Ryabinin 2018-04-10 130 unsigned int immediate; d108c7721 Andrey Ryabinin 2018-04-10 131 unsigned int file_taken; d108c7721 Andrey Ryabinin 2018-04-10 132 unsigned int taken; d108c7721 Andrey Ryabinin 2018-04-10 133 } nr; ^1da177e4 Linus Torvalds 2005-04-16 134 }; ^1da177e4 Linus Torvalds 2005-04-16 135 ^1da177e4 Linus Torvalds 2005-04-16 136 #ifdef ARCH_HAS_PREFETCH ^1da177e4 Linus Torvalds 2005-04-16 137 #define prefetch_prev_lru_page(_page, _base, _field) \ ^1da177e4 Linus Torvalds 2005-04-16 138 do { \ ^1da177e4 Linus Torvalds 2005-04-16 139 if ((_page)->lru.prev != _base) { \ ^1da177e4 Linus Torvalds 2005-04-16 140 struct page *prev; \ ^1da177e4 Linus Torvalds 2005-04-16 141 \ ^1da177e4 Linus Torvalds 2005-04-16 142 prev = lru_to_page(&(_page->lru)); \ ^1da177e4 Linus Torvalds 2005-04-16 143 prefetch(&prev->_field); \ ^1da177e4 Linus Torvalds 2005-04-16 144 } \ ^1da177e4 Linus Torvalds 2005-04-16 145 } while (0) ^1da177e4 Linus Torvalds 2005-04-16 146 #else ^1da177e4 Linus Torvalds 2005-04-16 147 #define prefetch_prev_lru_page(_page, _base, _field) do { } while (0) ^1da177e4 Linus Torvalds 2005-04-16 148 #endif ^1da177e4 Linus Torvalds 2005-04-16 149 ^1da177e4 Linus Torvalds 2005-04-16 150 #ifdef ARCH_HAS_PREFETCHW ^1da177e4 Linus Torvalds 2005-04-16 151 #define prefetchw_prev_lru_page(_page, _base, _field) \ ^1da177e4 Linus Torvalds 2005-04-16 152 do { \ ^1da177e4 Linus Torvalds 2005-04-16 153 if ((_page)->lru.prev != _base) { \ ^1da177e4 Linus Torvalds 2005-04-16 154 struct page *prev; \ ^1da177e4 Linus Torvalds 2005-04-16 155 \ ^1da177e4 Linus Torvalds 2005-04-16 156 prev = lru_to_page(&(_page->lru)); \ ^1da177e4 Linus Torvalds 2005-04-16 157 prefetchw(&prev->_field); \ ^1da177e4 Linus Torvalds 2005-04-16 158 } \ ^1da177e4 Linus Torvalds 2005-04-16 159 } while (0) ^1da177e4 Linus Torvalds 2005-04-16 160 #else ^1da177e4 Linus Torvalds 2005-04-16 161 #define prefetchw_prev_lru_page(_page, _base, _field) do { } while (0) ^1da177e4 Linus Torvalds 2005-04-16 162 #endif ^1da177e4 Linus Torvalds 2005-04-16 163 ^1da177e4 Linus Torvalds 2005-04-16 164 /* ^1da177e4 Linus Torvalds 2005-04-16 165 * From 0 .. 100. Higher means more swappy. ^1da177e4 Linus Torvalds 2005-04-16 166 */ ^1da177e4 Linus Torvalds 2005-04-16 167 int vm_swappiness = 60; d0480be44 Wang Sheng-Hui 2014-08-06 168 /* d0480be44 Wang Sheng-Hui 2014-08-06 169 * The total number of pages which are beyond the high watermark within all d0480be44 Wang Sheng-Hui 2014-08-06 170 * zones. d0480be44 Wang Sheng-Hui 2014-08-06 171 */ d0480be44 Wang Sheng-Hui 2014-08-06 172 unsigned long vm_total_pages; ^1da177e4 Linus Torvalds 2005-04-16 173 ^1da177e4 Linus Torvalds 2005-04-16 174 static LIST_HEAD(shrinker_list); ^1da177e4 Linus Torvalds 2005-04-16 175 static DECLARE_RWSEM(shrinker_rwsem); ^1da177e4 Linus Torvalds 2005-04-16 176 8236f517d Yang Shi 2019-07-05 177 #ifdef CONFIG_MEMCG 7e010df53 Kirill Tkhai 2018-08-17 178 /* 7e010df53 Kirill Tkhai 2018-08-17 179 * We allow subsystems to populate their shrinker-related 7e010df53 Kirill Tkhai 2018-08-17 180 * LRU lists before register_shrinker_prepared() is called 7e010df53 Kirill Tkhai 2018-08-17 181 * for the shrinker, since we don't want to impose 7e010df53 Kirill Tkhai 2018-08-17 182 * restrictions on their internal registration order. 7e010df53 Kirill Tkhai 2018-08-17 183 * In this case shrink_slab_memcg() may find corresponding 7e010df53 Kirill Tkhai 2018-08-17 184 * bit is set in the shrinkers map. 7e010df53 Kirill Tkhai 2018-08-17 185 * 7e010df53 Kirill Tkhai 2018-08-17 186 * This value is used by the function to detect registering 7e010df53 Kirill Tkhai 2018-08-17 187 * shrinkers and to skip do_shrink_slab() calls for them. 7e010df53 Kirill Tkhai 2018-08-17 188 */ 7e010df53 Kirill Tkhai 2018-08-17 189 #define SHRINKER_REGISTERING ((struct shrinker *)~0UL) 7e010df53 Kirill Tkhai 2018-08-17 190 b4c2b231c Kirill Tkhai 2018-08-17 191 static DEFINE_IDR(shrinker_idr); b4c2b231c Kirill Tkhai 2018-08-17 192 static int shrinker_nr_max; b4c2b231c Kirill Tkhai 2018-08-17 193 b4c2b231c Kirill Tkhai 2018-08-17 194 static int prealloc_memcg_shrinker(struct shrinker *shrinker) b4c2b231c Kirill Tkhai 2018-08-17 195 { b4c2b231c Kirill Tkhai 2018-08-17 196 int id, ret = -ENOMEM; b4c2b231c Kirill Tkhai 2018-08-17 197 b4c2b231c Kirill Tkhai 2018-08-17 198 down_write(&shrinker_rwsem); b4c2b231c Kirill Tkhai 2018-08-17 199 /* This may call shrinker, so it must use down_read_trylock() */ 7e010df53 Kirill Tkhai 2018-08-17 200 id = idr_alloc(&shrinker_idr, SHRINKER_REGISTERING, 0, 0, GFP_KERNEL); b4c2b231c Kirill Tkhai 2018-08-17 201 if (id < 0) b4c2b231c Kirill Tkhai 2018-08-17 202 goto unlock; b4c2b231c Kirill Tkhai 2018-08-17 203 0a4465d34 Kirill Tkhai 2018-08-17 204 if (id >= shrinker_nr_max) { 0a4465d34 Kirill Tkhai 2018-08-17 @205 if (memcg_expand_shrinker_maps(id)) { 0a4465d34 Kirill Tkhai 2018-08-17 206 idr_remove(&shrinker_idr, id); 0a4465d34 Kirill Tkhai 2018-08-17 207 goto unlock; 0a4465d34 Kirill Tkhai 2018-08-17 208 } 0a4465d34 Kirill Tkhai 2018-08-17 209 b4c2b231c Kirill Tkhai 2018-08-17 210 shrinker_nr_max = id + 1; 0a4465d34 Kirill Tkhai 2018-08-17 211 } b4c2b231c Kirill Tkhai 2018-08-17 212 shrinker->id = id; b4c2b231c Kirill Tkhai 2018-08-17 213 ret = 0; b4c2b231c Kirill Tkhai 2018-08-17 214 unlock: b4c2b231c Kirill Tkhai 2018-08-17 215 up_write(&shrinker_rwsem); b4c2b231c Kirill Tkhai 2018-08-17 216 return ret; b4c2b231c Kirill Tkhai 2018-08-17 217 } b4c2b231c Kirill Tkhai 2018-08-17 218 :::::: The code at line 205 was first introduced by commit :::::: 0a4465d340282f92719f4e3a56545a848e638d15 mm, memcg: assign memcg-aware shrinkers bitmap to memcg :::::: TO: Kirill Tkhai <ktkhai@xxxxxxxxxxxxx> :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip