public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* Re: [PATCH v3 01/20] mm/swap: decouple swap cache from physical swap infrastructure
       [not found] <20260208215839.87595-2-nphamcs@gmail.com>
@ 2026-02-09  2:22 ` kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-02-09  2:22 UTC (permalink / raw)
  To: Nhat Pham, linux-mm
  Cc: llvm, oe-kbuild-all, akpm, hannes, hughd, yosry.ahmed, mhocko,
	roman.gushchin, shakeel.butt, muchun.song, len.brown,
	chengming.zhou, kasong, chrisl, huang.ying.caritas, ryan.roberts,
	shikemeng, viro, baohua, bhe, osalvador, lorenzo.stoakes,
	christophe.leroy, pavel, kernel-team, linux-kernel, cgroups,
	linux-pm, peterx, riel, joshua.hahnjy

Hi Nhat,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.19]
[cannot apply to akpm-mm/mm-everything tj-cgroup/for-next tip/smp/core next-20260205]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Nhat-Pham/swap-rearrange-the-swap-header-file/20260209-065842
base:   linus/master
patch link:    https://lore.kernel.org/r/20260208215839.87595-2-nphamcs%40gmail.com
patch subject: [PATCH v3 01/20] mm/swap: decouple swap cache from physical swap infrastructure
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20260209/202602091044.soVrWeDA-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260209/202602091044.soVrWeDA-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602091044.soVrWeDA-lkp@intel.com/

All errors (new ones prefixed by >>):

>> mm/vmscan.c:715:3: error: call to undeclared function 'swap_cache_lock_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     715 |                 swap_cache_lock_irq();
         |                 ^
>> mm/vmscan.c:762:3: error: call to undeclared function 'swap_cache_unlock_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     762 |                 swap_cache_unlock_irq();
         |                 ^
   mm/vmscan.c:762:3: note: did you mean 'swap_cluster_unlock_irq'?
   mm/swap.h:350:20: note: 'swap_cluster_unlock_irq' declared here
     350 | static inline void swap_cluster_unlock_irq(struct swap_cluster_info *ci)
         |                    ^
   mm/vmscan.c:801:3: error: call to undeclared function 'swap_cache_unlock_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     801 |                 swap_cache_unlock_irq();
         |                 ^
   3 errors generated.
--
>> mm/shmem.c:2168:2: error: call to undeclared function 'swap_cache_lock_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2168 |         swap_cache_lock_irq();
         |         ^
>> mm/shmem.c:2173:2: error: call to undeclared function 'swap_cache_unlock_irq'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2173 |         swap_cache_unlock_irq();
         |         ^
   2 errors generated.


vim +/swap_cache_lock_irq +715 mm/vmscan.c

   700	
   701	/*
   702	 * Same as remove_mapping, but if the folio is removed from the mapping, it
   703	 * gets returned with a refcount of 0.
   704	 */
   705	static int __remove_mapping(struct address_space *mapping, struct folio *folio,
   706				    bool reclaimed, struct mem_cgroup *target_memcg)
   707	{
   708		int refcount;
   709		void *shadow = NULL;
   710	
   711		BUG_ON(!folio_test_locked(folio));
   712		BUG_ON(mapping != folio_mapping(folio));
   713	
   714		if (folio_test_swapcache(folio)) {
 > 715			swap_cache_lock_irq();
   716		} else {
   717			spin_lock(&mapping->host->i_lock);
   718			xa_lock_irq(&mapping->i_pages);
   719		}
   720	
   721		/*
   722		 * The non racy check for a busy folio.
   723		 *
   724		 * Must be careful with the order of the tests. When someone has
   725		 * a ref to the folio, it may be possible that they dirty it then
   726		 * drop the reference. So if the dirty flag is tested before the
   727		 * refcount here, then the following race may occur:
   728		 *
   729		 * get_user_pages(&page);
   730		 * [user mapping goes away]
   731		 * write_to(page);
   732		 *				!folio_test_dirty(folio)    [good]
   733		 * folio_set_dirty(folio);
   734		 * folio_put(folio);
   735		 *				!refcount(folio)   [good, discard it]
   736		 *
   737		 * [oops, our write_to data is lost]
   738		 *
   739		 * Reversing the order of the tests ensures such a situation cannot
   740		 * escape unnoticed. The smp_rmb is needed to ensure the folio->flags
   741		 * load is not satisfied before that of folio->_refcount.
   742		 *
   743		 * Note that if the dirty flag is always set via folio_mark_dirty,
   744		 * and thus under the i_pages lock, then this ordering is not required.
   745		 */
   746		refcount = 1 + folio_nr_pages(folio);
   747		if (!folio_ref_freeze(folio, refcount))
   748			goto cannot_free;
   749		/* note: atomic_cmpxchg in folio_ref_freeze provides the smp_rmb */
   750		if (unlikely(folio_test_dirty(folio))) {
   751			folio_ref_unfreeze(folio, refcount);
   752			goto cannot_free;
   753		}
   754	
   755		if (folio_test_swapcache(folio)) {
   756			swp_entry_t swap = folio->swap;
   757	
   758			if (reclaimed && !mapping_exiting(mapping))
   759				shadow = workingset_eviction(folio, target_memcg);
   760			__swap_cache_del_folio(folio, swap, shadow);
   761			memcg1_swapout(folio, swap);
 > 762			swap_cache_unlock_irq();
   763			put_swap_folio(folio, swap);
   764		} else {
   765			void (*free_folio)(struct folio *);
   766	
   767			free_folio = mapping->a_ops->free_folio;
   768			/*
   769			 * Remember a shadow entry for reclaimed file cache in
   770			 * order to detect refaults, thus thrashing, later on.
   771			 *
   772			 * But don't store shadows in an address space that is
   773			 * already exiting.  This is not just an optimization,
   774			 * inode reclaim needs to empty out the radix tree or
   775			 * the nodes are lost.  Don't plant shadows behind its
   776			 * back.
   777			 *
   778			 * We also don't store shadows for DAX mappings because the
   779			 * only page cache folios found in these are zero pages
   780			 * covering holes, and because we don't want to mix DAX
   781			 * exceptional entries and shadow exceptional entries in the
   782			 * same address_space.
   783			 */
   784			if (reclaimed && folio_is_file_lru(folio) &&
   785			    !mapping_exiting(mapping) && !dax_mapping(mapping))
   786				shadow = workingset_eviction(folio, target_memcg);
   787			__filemap_remove_folio(folio, shadow);
   788			xa_unlock_irq(&mapping->i_pages);
   789			if (mapping_shrinkable(mapping))
   790				inode_lru_list_add(mapping->host);
   791			spin_unlock(&mapping->host->i_lock);
   792	
   793			if (free_folio)
   794				free_folio(folio);
   795		}
   796	
   797		return 1;
   798	
   799	cannot_free:
   800		if (folio_test_swapcache(folio)) {
   801			swap_cache_unlock_irq();
   802		} else {
   803			xa_unlock_irq(&mapping->i_pages);
   804			spin_unlock(&mapping->host->i_lock);
   805		}
   806		return 0;
   807	}
   808	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-09  2:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260208215839.87595-2-nphamcs@gmail.com>
2026-02-09  2:22 ` [PATCH v3 01/20] mm/swap: decouple swap cache from physical swap infrastructure kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox