Re: [PATCH 1/2] mm/zswap: global lru and shrinker shared by all zswap_pools

From: kernel test robot
Date: Sun Feb 11 2024 - 17:06:29 EST


Hi Chengming,

kernel test robot noticed the following build errors:

[auto build test ERROR on 191d97734e41a5c9f90a2f6636fdd335ae1d435d]

url: https://github.com/intel-lab-lkp/linux/commits/Chengming-Zhou/mm-zswap-global-lru-and-shrinker-shared-by-all-zswap_pools/20240211-220028
base: 191d97734e41a5c9f90a2f6636fdd335ae1d435d
patch link: https://lore.kernel.org/r/20240210-zswap-global-lru-v1-1-853473d7b0da%40bytedance.com
patch subject: [PATCH 1/2] mm/zswap: global lru and shrinker shared by all zswap_pools
config: i386-randconfig-054-20240212 (https://download.01.org/0day-ci/archive/20240212/202402120503.HRNkoWyq-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240212/202402120503.HRNkoWyq-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402120503.HRNkoWyq-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> mm/zswap.c:1300:35: error: use of undeclared identifier 'pool'
1300 | nr_backing = get_zswap_pool_size(pool) >> PAGE_SHIFT;
| ^
1 error generated.


vim +/pool +1300 mm/zswap.c

b5ba474f3f5187 Nhat Pham 2023-11-30 1283
b5ba474f3f5187 Nhat Pham 2023-11-30 1284 static unsigned long zswap_shrinker_count(struct shrinker *shrinker,
b5ba474f3f5187 Nhat Pham 2023-11-30 1285 struct shrink_control *sc)
b5ba474f3f5187 Nhat Pham 2023-11-30 1286 {
b5ba474f3f5187 Nhat Pham 2023-11-30 1287 struct mem_cgroup *memcg = sc->memcg;
b5ba474f3f5187 Nhat Pham 2023-11-30 1288 struct lruvec *lruvec = mem_cgroup_lruvec(memcg, NODE_DATA(sc->nid));
b5ba474f3f5187 Nhat Pham 2023-11-30 1289 unsigned long nr_backing, nr_stored, nr_freeable, nr_protected;
b5ba474f3f5187 Nhat Pham 2023-11-30 1290
501a06fe8e4c18 Nhat Pham 2023-12-07 1291 if (!zswap_shrinker_enabled || !mem_cgroup_zswap_writeback_enabled(memcg))
b5ba474f3f5187 Nhat Pham 2023-11-30 1292 return 0;
b5ba474f3f5187 Nhat Pham 2023-11-30 1293
b5ba474f3f5187 Nhat Pham 2023-11-30 1294 #ifdef CONFIG_MEMCG_KMEM
7d7ef0a4686abe Yosry Ahmed 2023-11-29 1295 mem_cgroup_flush_stats(memcg);
b5ba474f3f5187 Nhat Pham 2023-11-30 1296 nr_backing = memcg_page_state(memcg, MEMCG_ZSWAP_B) >> PAGE_SHIFT;
b5ba474f3f5187 Nhat Pham 2023-11-30 1297 nr_stored = memcg_page_state(memcg, MEMCG_ZSWAPPED);
b5ba474f3f5187 Nhat Pham 2023-11-30 1298 #else
b5ba474f3f5187 Nhat Pham 2023-11-30 1299 /* use pool stats instead of memcg stats */
b5ba474f3f5187 Nhat Pham 2023-11-30 @1300 nr_backing = get_zswap_pool_size(pool) >> PAGE_SHIFT;
bf414d6ae81ba2 Chengming Zhou 2024-02-11 1301 nr_stored = atomic_read(&zswap.nr_stored);
b5ba474f3f5187 Nhat Pham 2023-11-30 1302 #endif
b5ba474f3f5187 Nhat Pham 2023-11-30 1303
b5ba474f3f5187 Nhat Pham 2023-11-30 1304 if (!nr_stored)
b5ba474f3f5187 Nhat Pham 2023-11-30 1305 return 0;
b5ba474f3f5187 Nhat Pham 2023-11-30 1306
b5ba474f3f5187 Nhat Pham 2023-11-30 1307 nr_protected =
b5ba474f3f5187 Nhat Pham 2023-11-30 1308 atomic_long_read(&lruvec->zswap_lruvec_state.nr_zswap_protected);
bf414d6ae81ba2 Chengming Zhou 2024-02-11 1309 nr_freeable = list_lru_shrink_count(&zswap.list_lru, sc);
b5ba474f3f5187 Nhat Pham 2023-11-30 1310 /*
b5ba474f3f5187 Nhat Pham 2023-11-30 1311 * Subtract the lru size by an estimate of the number of pages
b5ba474f3f5187 Nhat Pham 2023-11-30 1312 * that should be protected.
b5ba474f3f5187 Nhat Pham 2023-11-30 1313 */
b5ba474f3f5187 Nhat Pham 2023-11-30 1314 nr_freeable = nr_freeable > nr_protected ? nr_freeable - nr_protected : 0;
b5ba474f3f5187 Nhat Pham 2023-11-30 1315
b5ba474f3f5187 Nhat Pham 2023-11-30 1316 /*
b5ba474f3f5187 Nhat Pham 2023-11-30 1317 * Scale the number of freeable pages by the memory saving factor.
b5ba474f3f5187 Nhat Pham 2023-11-30 1318 * This ensures that the better zswap compresses memory, the fewer
b5ba474f3f5187 Nhat Pham 2023-11-30 1319 * pages we will evict to swap (as it will otherwise incur IO for
b5ba474f3f5187 Nhat Pham 2023-11-30 1320 * relatively small memory saving).
b5ba474f3f5187 Nhat Pham 2023-11-30 1321 */
b5ba474f3f5187 Nhat Pham 2023-11-30 1322 return mult_frac(nr_freeable, nr_backing, nr_stored);
b5ba474f3f5187 Nhat Pham 2023-11-30 1323 }
b5ba474f3f5187 Nhat Pham 2023-11-30 1324

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki