Skip to contentSkip to conversation

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

PATCH kernel test robot 3 participants 3 messages May 28 – May 29

Subsystems (2)
lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

maintainer
#1 lore raw
Quoted 12 lines · On Thu, 28 May 2026 16:15:31 +0800 kernel test robot <[email protected]> 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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 6 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

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 <[email protected]>
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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Cc Baolin Wang <[email protected]>
Cc Barry Song <[email protected]>
Cc Dave Chinner <[email protected]>
Cc David Hildenbrand (Arm) <[email protected]>
Cc Dev Jain <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Kairui Song <[email protected]>
Cc Lance Yang <[email protected]>
Cc Liam R. Howlett <[email protected]>
Cc Lorenzo Stoakes (Oracle) <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Mikhail Zaslonko <[email protected]>
Cc Muchun Song <[email protected]>
Cc Nico Pache <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Shakeel Butt <[email protected]>
Cc Usama Arif <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Vlastimil Babka <[email protected]>
Cc Zi Yan <[email protected]>

---

 include/linux/huge_mm.h |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
include/linux/huge_mm.h renamed from include/linux/huge_mm.h~mm-switch-deferred-split-shrinker-to-list_lru-fix +9 -1
@@ -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)
 

_

#2 lore raw
Quoted 21 lines · Andrew Morton
Quoted 12 lines · On Thu, 28 May 2026 16:15:31 +0800 kernel test robot <[email protected]> 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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Quoted 6 lines

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

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.

Quoted 8 lines

Thanks. How does this look?

From: Andrew Morton <[email protected]>
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 :)