Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [akpm-mm:mm-new 429/433] mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations
@ 2026-05-28  8:15 kernel test robot
  2026-05-28 22:16 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-05-28  8:15 UTC (permalink / raw)
  To: Johannes Weiner
  Cc: llvm, oe-kbuild-all, David Hildenbrand, Andrew Morton,
	Linux Memory Management List, mm-commits,
	Lorenzo Stoakes (Oracle)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   d7d405cc33d6e3eeba2d6ec8f0b595da2a5c600a
commit: a5e62d9e00dac6f96174c397a82da30e7ae53064 [429/433] mm: switch deferred split shrinker to list_lru
config: hexagon-defconfig (https://download.01.org/0day-ci/archive/20260528/202605281620.lc3rtkBm-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281620.lc3rtkBm-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/202605281620.lc3rtkBm-lkp@intel.com/

All errors (new ones prefixed by >>):

>> mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     468 |         if (order > 1 && folio_memcg_alloc_deferred(folio)) {
         |                          ^
   1 error generated.


vim +/folio_memcg_alloc_deferred +468 mm/swap_state.c

   390	
   391	/*
   392	 * Try to allocate a folio of given order in the swap cache.
   393	 *
   394	 * This helper resolves the potential races of swap allocation
   395	 * and prepares a folio to be used for swap IO. May return following
   396	 * value:
   397	 *
   398	 * -ENOMEM / -EBUSY: Order is too large or in conflict with sub slot,
   399	 *                   caller should shrink the order and retry
   400	 * -ENOENT / -EEXIST: Target swap entry is unavailable or cached, the caller
   401	 *                    should abort or try to use the cached folio instead
   402	 */
   403	static struct folio *__swap_cache_alloc(struct swap_cluster_info *ci,
   404						swp_entry_t targ_entry, gfp_t gfp,
   405						unsigned int order, struct vm_fault *vmf,
   406						struct mempolicy *mpol, pgoff_t ilx)
   407	{
   408		int err;
   409		swp_entry_t entry;
   410		struct folio *folio;
   411		void *shadow = NULL;
   412		unsigned short memcg_id;
   413		unsigned long address, nr_pages = 1UL << order;
   414		struct vm_area_struct *vma = vmf ? vmf->vma : NULL;
   415	
   416		VM_WARN_ON_ONCE(nr_pages > SWAPFILE_CLUSTER);
   417		entry.val = round_down(targ_entry.val, nr_pages);
   418	
   419		/* Check if the slot and range are available, skip allocation if not */
   420		spin_lock(&ci->lock);
   421		err = __swap_cache_add_check(ci, targ_entry, nr_pages, NULL, NULL);
   422		spin_unlock(&ci->lock);
   423		if (unlikely(err))
   424			return ERR_PTR(err);
   425	
   426		/*
   427		 * Limit THP gfp. The limitation is a no-op for typical
   428		 * GFP_HIGHUSER_MOVABLE but matters for shmem.
   429		 */
   430		if (order)
   431			gfp = thp_shmem_limit_gfp_mask(vma_thp_gfp_mask(vma), gfp);
   432	
   433		if (mpol || !vmf) {
   434			folio = folio_alloc_mpol(gfp, order, mpol, ilx, numa_node_id());
   435		} else {
   436			address = round_down(vmf->address, PAGE_SIZE << order);
   437			folio = vma_alloc_folio(gfp, order, vmf->vma, address);
   438		}
   439		if (unlikely(!folio))
   440			return ERR_PTR(-ENOMEM);
   441	
   442		/* Double check the range is still not in conflict */
   443		spin_lock(&ci->lock);
   444		err = __swap_cache_add_check(ci, targ_entry, nr_pages, &shadow, &memcg_id);
   445		if (unlikely(err)) {
   446			spin_unlock(&ci->lock);
   447			folio_put(folio);
   448			return ERR_PTR(err);
   449		}
   450	
   451		__folio_set_locked(folio);
   452		__folio_set_swapbacked(folio);
   453		__swap_cache_do_add_folio(ci, folio, entry);
   454		spin_unlock(&ci->lock);
   455	
   456		if (mem_cgroup_swapin_charge_folio(folio, memcg_id,
   457						   vmf ? vmf->vma->vm_mm : NULL, gfp)) {
   458			spin_lock(&ci->lock);
   459			__swap_cache_do_del_folio(ci, folio, entry, shadow);
   460			spin_unlock(&ci->lock);
   461			folio_unlock(folio);
   462			/* nr_pages refs from swap cache, 1 from allocation */
   463			folio_put_refs(folio, nr_pages + 1);
   464			count_mthp_stat(order, MTHP_STAT_SWPIN_FALLBACK_CHARGE);
   465			return ERR_PTR(-ENOMEM);
   466		}
   467	
 > 468		if (order > 1 && folio_memcg_alloc_deferred(folio)) {
   469			spin_lock(&ci->lock);
   470			__swap_cache_do_del_folio(ci, folio, entry, shadow);
   471			spin_unlock(&ci->lock);
   472			folio_unlock(folio);
   473			/* nr_pages refs from swap cache, 1 from allocation */
   474			folio_put_refs(folio, nr_pages + 1);
   475			return ERR_PTR(-ENOMEM);
   476		}
   477	
   478		/* memsw uncharges swap when folio is added to swap cache */
   479		memcg1_swapin(folio);
   480		if (shadow)
   481			workingset_refault(folio, shadow);
   482	
   483		node_stat_mod_folio(folio, NR_FILE_PAGES, nr_pages);
   484		lruvec_stat_mod_folio(folio, NR_SWAPCACHE, nr_pages);
   485	
   486		/* Caller will initiate read into locked new_folio */
   487		folio_add_lru(folio);
   488		return folio;
   489	}
   490	

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [akpm-mm:mm-new 429/433] mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations
  2026-05-28  8:15 [akpm-mm:mm-new 429/433] mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations kernel test robot
@ 2026-05-28 22:16 ` Andrew Morton
  2026-05-29 12:35   ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-05-28 22:16 UTC (permalink / raw)
  To: kernel test robot
  Cc: Johannes Weiner, llvm, oe-kbuild-all, David Hildenbrand,
	Linux Memory Management List, mm-commits,
	Lorenzo Stoakes (Oracle)

On Thu, 28 May 2026 16:15:31 +0800 kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> head:   d7d405cc33d6e3eeba2d6ec8f0b595da2a5c600a
> commit: a5e62d9e00dac6f96174c397a82da30e7ae53064 [429/433] mm: switch deferred split shrinker to list_lru
> config: hexagon-defconfig (https://download.01.org/0day-ci/archive/20260528/202605281620.lc3rtkBm-lkp@intel.com/config)
> compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281620.lc3rtkBm-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/202605281620.lc3rtkBm-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
> >> mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>      468 |         if (order > 1 && folio_memcg_alloc_deferred(folio)) {
>          |                          ^
>    1 error generated.

Thanks.  How does this look?


From: Andrew Morton <akpm@linux-foundation.org>
Subject: mm-switch-deferred-split-shrinker-to-list_lru-fix
Date: Thu May 28 03:12:45 PM PDT 2026

fix build with CONFIG_TRANSPARENT_HUGEPAGE=n

| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605281620.lc3rtkBm-lkp@intel.com/
Link: https://lore.kernel.org/202605281620.lc3rtkBm-lkp@intel.com
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: David Hildenbrand (Arm) <david@kernel.org>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <ryncsn@gmail.com>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes (Oracle) <ljs@kernel.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Nico Pache <npache@redhat.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Usama Arif <usama.arif@linux.dev>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/huge_mm.h |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

--- a/include/linux/huge_mm.h~mm-switch-deferred-split-shrinker-to-list_lru-fix
+++ a/include/linux/huge_mm.h
@@ -663,7 +663,15 @@ static inline int folio_split(struct fol
 	return -EINVAL;
 }
 
-static inline void deferred_split_folio(struct folio *folio, bool partially_mapped) {}
+static inline int folio_memcg_alloc_deferred(struct folio *folio)
+{
+	return 0;
+}
+
+static inline void deferred_split_folio(struct folio *folio, bool partially_mapped)
+{
+}
+
 #define split_huge_pmd(__vma, __pmd, __address)	\
 	do { } while (0)
 
_



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [akpm-mm:mm-new 429/433] mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations
  2026-05-28 22:16 ` Andrew Morton
@ 2026-05-29 12:35   ` Johannes Weiner
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2026-05-29 12:35 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, llvm, oe-kbuild-all, David Hildenbrand,
	Linux Memory Management List, mm-commits,
	Lorenzo Stoakes (Oracle)

On Thu, May 28, 2026 at 03:16:18PM -0700, Andrew Morton wrote:
> On Thu, 28 May 2026 16:15:31 +0800 kernel test robot <lkp@intel.com> wrote:
> 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> > head:   d7d405cc33d6e3eeba2d6ec8f0b595da2a5c600a
> > commit: a5e62d9e00dac6f96174c397a82da30e7ae53064 [429/433] mm: switch deferred split shrinker to list_lru
> > config: hexagon-defconfig (https://download.01.org/0day-ci/archive/20260528/202605281620.lc3rtkBm-lkp@intel.com/config)
> > compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281620.lc3rtkBm-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/202605281620.lc3rtkBm-lkp@intel.com/
> > 
> > All errors (new ones prefixed by >>):
> > 
> > >> mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> >      468 |         if (order > 1 && folio_memcg_alloc_deferred(folio)) {
> >          |                          ^
> >    1 error generated.
> 
> Thanks.  How does this look?
> 
> 
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: mm-switch-deferred-split-shrinker-to-list_lru-fix
> Date: Thu May 28 03:12:45 PM PDT 2026
> 
> fix build with CONFIG_TRANSPARENT_HUGEPAGE=n

Thanks! SJ also sent a fix to this end. Either of them will work :)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-29 12:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28  8:15 [akpm-mm:mm-new 429/433] mm/swap_state.c:468:19: error: call to undeclared function 'folio_memcg_alloc_deferred'; ISO C99 and later do not support implicit function declarations kernel test robot
2026-05-28 22:16 ` Andrew Morton
2026-05-29 12:35   ` Johannes Weiner

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