Re: [PATCH 5/8] mm/tests: add cleancache kunit test

From: kernel test robot

Date: Fri Oct 10 2025 - 22:58:19 EST


Hi Suren,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 70478cb9da6fc4e7b987219173ba1681d5f7dd3d]

url: https://github.com/intel-lab-lkp/linux/commits/Suren-Baghdasaryan/mm-implement-cleancache/20251010-134501
base: 70478cb9da6fc4e7b987219173ba1681d5f7dd3d
patch link: https://lore.kernel.org/r/20251010011951.2136980-6-surenb%40google.com
patch subject: [PATCH 5/8] mm/tests: add cleancache kunit test
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20251011/202510111059.aKceYLLH-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/202510111059.aKceYLLH-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/202510111059.aKceYLLH-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> mm/tests/cleancache_kunit.c:358:6: warning: variable 'unused' set but not used [-Wunused-but-set-variable]
358 | int unused = 0;
| ^
1 warning generated.


vim +/unused +358 mm/tests/cleancache_kunit.c

353
354 static void cleancache_backend_api_test(struct kunit *test)
355 {
356 struct folio *folio;
357 LIST_HEAD(folios);
> 358 int unused = 0;
359 int used = 0;
360
361 /* Store inode folios into cleancache */
362 fill_cleancache(test);
363
364 /* Get all donated folios back */
365 for (int fidx = 0; fidx < FOLIO_COUNT; fidx++) {
366 KUNIT_EXPECT_EQ(test, cleancache_backend_get_folio(test_data.pool_id,
367 test_data.pool_folios[fidx]), 0);
368 set_page_refcounted(&test_data.pool_folios[fidx]->page);
369 }
370
371 /* Try putting a refcounted folio */
372 KUNIT_EXPECT_NE(test, cleancache_backend_put_folio(test_data.pool_id,
373 test_data.pool_folios[0]), 0);
374
375 /* Put some of the folios back into cleancache */
376 for (int fidx = 0; fidx < FOLIOS_PER_INODE; fidx++) {
377 folio_ref_freeze(test_data.pool_folios[fidx], 1);
378 KUNIT_EXPECT_EQ(test, cleancache_backend_put_folio(test_data.pool_id,
379 test_data.pool_folios[fidx]), 0);
380 }
381
382 /* Put the rest back into cleancache but keep half of folios still refcounted */
383 for (int fidx = FOLIOS_PER_INODE; fidx < FOLIO_COUNT; fidx++) {
384 if (fidx % 2) {
385 folio_ref_freeze(test_data.pool_folios[fidx], 1);
386 unused++;
387 } else {
388 used++;
389 }
390 list_add(&test_data.pool_folios[fidx]->lru, &folios);
391 }
392 KUNIT_EXPECT_NE(test, cleancache_backend_put_folios(test_data.pool_id,
393 &folios), 0);
394 /* Used folios should be still in the list */
395 KUNIT_EXPECT_EQ(test, list_count_nodes(&folios), used);
396
397 /* Release refcounts and put the remaining folios into cleancache */
398 list_for_each_entry(folio, &folios, lru)
399 folio_ref_freeze(folio, 1);
400 KUNIT_EXPECT_EQ(test, cleancache_backend_put_folios(test_data.pool_id,
401 &folios), 0);
402 KUNIT_EXPECT_TRUE(test, list_empty(&folios));
403 }
404

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