CC: [email protected] CC: [email protected] TO: Huang Ying <[email protected]>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vishal/tiering.git tiering-0.8 head: d58c7b0e1a99a2ec17f2910a310835bafc50b4d1 commit: 17a24a354e12d4d4675d78481b358f668d5a6866 [15/44] memory tiering: avoid kswap to be keep in failure state for long :::::: branch date: 2 days ago :::::: commit date: 10 weeks ago config: x86_64-randconfig-m001 (https://download.01.org/0day-ci/archive/20220115/[email protected]/config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> smatch warnings: mm/vmscan.c:4261 kswapd_try_to_sleep() warn: bitwise AND condition is false here vim +4261 mm/vmscan.c e716f2eb24defb Mel Gorman 2017-05-03 4183 38087d9b036098 Mel Gorman 2016-07-28 4184 static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_order, 97a225e69a1f88 Joonsoo Kim 2020-06-03 4185 unsigned int highest_zoneidx) f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4186 { f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4187 long remaining = 0; f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4188 DEFINE_WAIT(wait); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4189 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4190 if (freezing(current) || kthread_should_stop()) f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4191 return; f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4192 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4193 prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4194 333b0a459c0e1b Shantanu Goel 2017-05-03 4195 /* 333b0a459c0e1b Shantanu Goel 2017-05-03 4196 * Try to sleep for a short interval. Note that kcompactd will only be 333b0a459c0e1b Shantanu Goel 2017-05-03 4197 * woken if it is possible to sleep for a short interval. This is 333b0a459c0e1b Shantanu Goel 2017-05-03 4198 * deliberate on the assumption that if reclaim cannot keep an 333b0a459c0e1b Shantanu Goel 2017-05-03 4199 * eligible zone balanced that it's also unlikely that compaction will 333b0a459c0e1b Shantanu Goel 2017-05-03 4200 * succeed. 333b0a459c0e1b Shantanu Goel 2017-05-03 4201 */ 97a225e69a1f88 Joonsoo Kim 2020-06-03 4202 if (prepare_kswapd_sleep(pgdat, reclaim_order, highest_zoneidx)) { fd901c95388b3b Vlastimil Babka 2016-04-28 4203 /* fd901c95388b3b Vlastimil Babka 2016-04-28 4204 * Compaction records what page blocks it recently failed to fd901c95388b3b Vlastimil Babka 2016-04-28 4205 * isolate pages from and skips them in the future scanning. fd901c95388b3b Vlastimil Babka 2016-04-28 4206 * When kswapd is going to sleep, it is reasonable to assume fd901c95388b3b Vlastimil Babka 2016-04-28 4207 * that pages and compaction may succeed so reset the cache. fd901c95388b3b Vlastimil Babka 2016-04-28 4208 */ fd901c95388b3b Vlastimil Babka 2016-04-28 4209 reset_isolation_suitable(pgdat); fd901c95388b3b Vlastimil Babka 2016-04-28 4210 fd901c95388b3b Vlastimil Babka 2016-04-28 4211 /* fd901c95388b3b Vlastimil Babka 2016-04-28 4212 * We have freed the memory, now we should compact it to make fd901c95388b3b Vlastimil Babka 2016-04-28 4213 * allocation of the requested order possible. fd901c95388b3b Vlastimil Babka 2016-04-28 4214 */ 97a225e69a1f88 Joonsoo Kim 2020-06-03 4215 wakeup_kcompactd(pgdat, alloc_order, highest_zoneidx); fd901c95388b3b Vlastimil Babka 2016-04-28 4216 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4217 remaining = schedule_timeout(HZ/10); 38087d9b036098 Mel Gorman 2016-07-28 4218 38087d9b036098 Mel Gorman 2016-07-28 4219 /* 97a225e69a1f88 Joonsoo Kim 2020-06-03 4220 * If woken prematurely then reset kswapd_highest_zoneidx and 38087d9b036098 Mel Gorman 2016-07-28 4221 * order. The values will either be from a wakeup request or 38087d9b036098 Mel Gorman 2016-07-28 4222 * the previous request that slept prematurely. 38087d9b036098 Mel Gorman 2016-07-28 4223 */ 38087d9b036098 Mel Gorman 2016-07-28 4224 if (remaining) { 97a225e69a1f88 Joonsoo Kim 2020-06-03 4225 WRITE_ONCE(pgdat->kswapd_highest_zoneidx, 97a225e69a1f88 Joonsoo Kim 2020-06-03 4226 kswapd_highest_zoneidx(pgdat, 97a225e69a1f88 Joonsoo Kim 2020-06-03 4227 highest_zoneidx)); 5644e1fbbfe15a Qian Cai 2020-04-01 4228 5644e1fbbfe15a Qian Cai 2020-04-01 4229 if (READ_ONCE(pgdat->kswapd_order) < reclaim_order) 5644e1fbbfe15a Qian Cai 2020-04-01 4230 WRITE_ONCE(pgdat->kswapd_order, reclaim_order); 38087d9b036098 Mel Gorman 2016-07-28 4231 } 38087d9b036098 Mel Gorman 2016-07-28 4232 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4233 finish_wait(&pgdat->kswapd_wait, &wait); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4234 prepare_to_wait(&pgdat->kswapd_wait, &wait, TASK_INTERRUPTIBLE); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4235 } f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4236 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4237 /* f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4238 * After a short sleep, check if it was a premature sleep. If not, then f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4239 * go fully to sleep until explicitly woken up. f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4240 */ d9f21d426dc606 Mel Gorman 2016-07-28 4241 if (!remaining && 97a225e69a1f88 Joonsoo Kim 2020-06-03 4242 prepare_kswapd_sleep(pgdat, reclaim_order, highest_zoneidx)) { f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4243 trace_mm_vmscan_kswapd_sleep(pgdat->node_id); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4244 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4245 /* f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4246 * vmstat counters are not perfectly accurate and the estimated f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4247 * value for counters such as NR_FREE_PAGES can deviate from the f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4248 * true value by nr_online_cpus * threshold. To avoid the zone f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4249 * watermarks being breached while under pressure, we reduce the f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4250 * per-cpu vmstat threshold while kswapd is awake and restore f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4251 * them before going back to sleep. f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4252 */ f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4253 set_pgdat_percpu_threshold(pgdat, calculate_normal_threshold); 1c7e7f6c0703d0 Aaditya Kumar 2012-07-17 4254 17a24a354e12d4 Huang Ying 2019-10-29 4255 if (!kthread_should_stop()) { 17a24a354e12d4 Huang Ying 2019-10-29 4256 /* 17a24a354e12d4 Huang Ying 2019-10-29 4257 * In memory tiering mode, try harder to recover from 17a24a354e12d4 Huang Ying 2019-10-29 4258 * kswapd failures, because direct reclaiming may be 17a24a354e12d4 Huang Ying 2019-10-29 4259 * not triggered. 17a24a354e12d4 Huang Ying 2019-10-29 4260 */ 17a24a354e12d4 Huang Ying 2019-10-29 @4261 if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING && 17a24a354e12d4 Huang Ying 2019-10-29 4262 node_is_toptier(pgdat->node_id) && 17a24a354e12d4 Huang Ying 2019-10-29 4263 pgdat->kswapd_failures >= MAX_RECLAIM_RETRIES) { 17a24a354e12d4 Huang Ying 2019-10-29 4264 remaining = schedule_timeout(10 * HZ); 17a24a354e12d4 Huang Ying 2019-10-29 4265 if (!remaining) { 17a24a354e12d4 Huang Ying 2019-10-29 4266 pgdat->kswapd_highest_zoneidx = ZONE_MOVABLE; 17a24a354e12d4 Huang Ying 2019-10-29 4267 pgdat->kswapd_order = 0; 17a24a354e12d4 Huang Ying 2019-10-29 4268 } 17a24a354e12d4 Huang Ying 2019-10-29 4269 } else f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4270 schedule(); 17a24a354e12d4 Huang Ying 2019-10-29 4271 } 1c7e7f6c0703d0 Aaditya Kumar 2012-07-17 4272 f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4273 set_pgdat_percpu_threshold(pgdat, calculate_pressure_threshold); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4274 } else { f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4275 if (remaining) f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4276 count_vm_event(KSWAPD_LOW_WMARK_HIT_QUICKLY); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4277 else f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4278 count_vm_event(KSWAPD_HIGH_WMARK_HIT_QUICKLY); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4279 } f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4280 finish_wait(&pgdat->kswapd_wait, &wait); f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4281 } f0bc0a60b13f20 KOSAKI Motohiro 2011-01-13 4282 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
