* [akpm-mm:mm-unstable 199/420] mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations
@ 2026-05-28 9:58 kernel test robot
2026-05-28 21:45 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-05-28 9:58 UTC (permalink / raw)
To: Kairui Song
Cc: llvm, oe-kbuild-all, David Hildenbrand, Andrew Morton,
Linux Memory Management List, mm-commits
tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
head: 8a74e22643189e0ae339afc91110ddb4cab1941b
commit: 93680c2b51fa1f84fe50800b71140dbd283372b8 [199/420] mm/memcg, swap: store cgroup id in cluster table directly
config: arm-randconfig-004-20260528 (https://download.01.org/0day-ci/archive/20260528/202605281711.bSeZlErK-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281711.bSeZlErK-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/202605281711.bSeZlErK-lkp@intel.com/
All errors (new ones prefixed by >>):
>> mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
651 | __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries,
| ^
mm/memcontrol-v1.c:721:31: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
721 | id = __swap_cgroup_clear(ci, swp_cluster_offset(folio->swap),
| ^
2 errors generated.
vim +/swp_cluster_offset +651 mm/memcontrol-v1.c
606
607 /**
608 * __memcg1_swapout - transfer a memsw charge to swap
609 * @folio: folio whose memsw charge to transfer
610 * @ci: the locked swap cluster holding the swap entries
611 *
612 * Transfer the memsw charge of @folio to the swap entry stored in
613 * folio->swap.
614 *
615 * Context: folio must be isolated, unmapped, locked and is just about to
616 * be freed, and caller must disable IRQs and hold the swap cluster lock.
617 */
618 void __memcg1_swapout(struct folio *folio, struct swap_cluster_info *ci)
619 {
620 struct mem_cgroup *memcg, *swap_memcg;
621 struct obj_cgroup *objcg;
622 unsigned int nr_entries;
623
624 VM_WARN_ON_ONCE_FOLIO(!folio_test_swapcache(folio), folio);
625 VM_WARN_ON_ONCE_FOLIO(!folio_test_locked(folio), folio);
626 VM_BUG_ON_FOLIO(folio_test_lru(folio), folio);
627 VM_BUG_ON_FOLIO(folio_ref_count(folio), folio);
628
629 if (mem_cgroup_disabled())
630 return;
631
632 if (!do_memsw_account())
633 return;
634
635 objcg = folio_objcg(folio);
636 VM_WARN_ON_ONCE_FOLIO(!objcg, folio);
637 if (!objcg)
638 return;
639
640 rcu_read_lock();
641 memcg = obj_cgroup_memcg(objcg);
642 /*
643 * In case the memcg owning these pages has been offlined and doesn't
644 * have an ID allocated to it anymore, charge the closest online
645 * ancestor for the swap instead and transfer the memory+swap charge.
646 */
647 nr_entries = folio_nr_pages(folio);
648 swap_memcg = mem_cgroup_private_id_get_online(memcg, nr_entries);
649 mod_memcg_state(swap_memcg, MEMCG_SWAP, nr_entries);
650
> 651 __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries,
652 mem_cgroup_private_id(swap_memcg));
653
654 folio_unqueue_deferred_split(folio);
655 folio->memcg_data = 0;
656
657 if (!obj_cgroup_is_root(objcg))
658 page_counter_uncharge(&memcg->memory, nr_entries);
659
660 if (memcg != swap_memcg) {
661 if (!mem_cgroup_is_root(swap_memcg))
662 page_counter_charge(&swap_memcg->memsw, nr_entries);
663 page_counter_uncharge(&memcg->memsw, nr_entries);
664 }
665
666 /*
667 * The caller must hold the swap cluster lock with IRQ off. It is
668 * important here to have the interrupts disabled because it is the
669 * only synchronisation we have for updating the per-CPU variables.
670 */
671 preempt_disable_nested();
672 VM_WARN_ON_IRQS_ENABLED();
673 memcg1_charge_statistics(memcg, -folio_nr_pages(folio));
674 preempt_enable_nested();
675 memcg1_check_events(memcg, folio_nid(folio));
676
677 rcu_read_unlock();
678 obj_cgroup_put(objcg);
679 }
680
--
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-unstable 199/420] mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations
2026-05-28 9:58 [akpm-mm:mm-unstable 199/420] mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations kernel test robot
@ 2026-05-28 21:45 ` Andrew Morton
2026-05-29 2:19 ` Kairui Song
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2026-05-28 21:45 UTC (permalink / raw)
To: kernel test robot
Cc: Kairui Song, llvm, oe-kbuild-all, David Hildenbrand,
Linux Memory Management List, mm-commits, Michal Hocko,
Roman Gushchin, Johannes Weiner, Shakeel Butt, Muchun Song
On Thu, 28 May 2026 17:58:34 +0800 kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> head: 8a74e22643189e0ae339afc91110ddb4cab1941b
> commit: 93680c2b51fa1f84fe50800b71140dbd283372b8 [199/420] mm/memcg, swap: store cgroup id in cluster table directly
> config: arm-randconfig-004-20260528 (https://download.01.org/0day-ci/archive/20260528/202605281711.bSeZlErK-lkp@intel.com/config)
> compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
> rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281711.bSeZlErK-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/202605281711.bSeZlErK-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> >> mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> 651 | __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries,
> | ^
> mm/memcontrol-v1.c:721:31: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> 721 | id = __swap_cgroup_clear(ci, swp_cluster_offset(folio->swap),
> | ^
> 2 errors generated.
OK, CONFIG_SWAP=n.
We could hack in a stub for swp_cluster_offset(), but why are we
compiling __memcg1_swapout() at all when CONFIG_SWAP=n? Ditto
memcg1_swapin().
How does the below look?
Really this should be done as a preparatory thing, but we'll survive.
From: Andrew Morton <akpm@linux-foundation.org>
Subject: memcgv1: don't compile swap functions when CONFIG_SWAP=n
Date: Thu May 28 02:35:22 PM PDT 2026
Stub these out to save some dead code and to fix a build error with the
upcoming "mm/memcg, swap: store cgroup id in cluster table directly".
Link: https://lore.kernel.org/202605281711.bSeZlErK-lkp@intel.com
Cc: David Hildenbrand <david@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <kasong@tencent.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memcontrol.h | 15 ++++++++++-----
mm/memcontrol-v1.c | 2 ++
2 files changed, 12 insertions(+), 5 deletions(-)
--- a/include/linux/memcontrol.h~mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix
+++ a/include/linux/memcontrol.h
@@ -1900,9 +1900,6 @@ static inline void mem_cgroup_exit_user_
current->in_user_fault = 0;
}
-void __memcg1_swapout(struct folio *folio, struct swap_cluster_info *ci);
-void memcg1_swapin(struct folio *folio);
-
#else /* CONFIG_MEMCG_V1 */
static inline
unsigned long memcg1_soft_limit_reclaim(pg_data_t *pgdat, int order,
@@ -1930,6 +1927,15 @@ static inline void mem_cgroup_exit_user_
{
}
+#endif /* CONFIG_MEMCG_V1 */
+
+#if defined(CONFIG_MEMCG_V1) && defined(CONFIG_SWAP)
+
+void __memcg1_swapout(struct folio *folio, struct swap_cluster_info *ci);
+void memcg1_swapin(struct folio *folio);
+
+#else
+
static inline void __memcg1_swapout(struct folio *folio,
struct swap_cluster_info *ci)
{
@@ -1938,7 +1944,6 @@ static inline void __memcg1_swapout(stru
static inline void memcg1_swapin(struct folio *folio)
{
}
-
-#endif /* CONFIG_MEMCG_V1 */
+#endif
#endif /* _LINUX_MEMCONTROL_H */
--- a/mm/memcontrol-v1.c~mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix
+++ a/mm/memcontrol-v1.c
@@ -604,6 +604,7 @@ void memcg1_commit_charge(struct folio *
local_irq_restore(flags);
}
+#ifdef CONFIG_SWAP
/**
* __memcg1_swapout - transfer a memsw charge to swap
* @folio: folio whose memsw charge to transfer
@@ -723,6 +724,7 @@ void memcg1_swapin(struct folio *folio)
swap_cluster_unlock(ci);
mem_cgroup_uncharge_swap(id, nr_pages);
}
+#endif
void memcg1_uncharge_batch(struct mem_cgroup *memcg, unsigned long pgpgout,
unsigned long nr_memory, int nid)
_
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [akpm-mm:mm-unstable 199/420] mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations
2026-05-28 21:45 ` Andrew Morton
@ 2026-05-29 2:19 ` Kairui Song
0 siblings, 0 replies; 3+ messages in thread
From: Kairui Song @ 2026-05-29 2:19 UTC (permalink / raw)
To: Andrew Morton
Cc: kernel test robot, Kairui Song, llvm, oe-kbuild-all,
David Hildenbrand, Linux Memory Management List, mm-commits,
Michal Hocko, Roman Gushchin, Johannes Weiner, Shakeel Butt,
Muchun Song
On Thu, May 28, 2026 at 02:45:02PM +0800, Andrew Morton wrote:
> On Thu, 28 May 2026 17:58:34 +0800 kernel test robot <lkp@intel.com> wrote:
>
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-unstable
> > head: 8a74e22643189e0ae339afc91110ddb4cab1941b
> > commit: 93680c2b51fa1f84fe50800b71140dbd283372b8 [199/420] mm/memcg, swap: store cgroup id in cluster table directly
> > config: arm-randconfig-004-20260528 (https://download.01.org/0day-ci/archive/20260528/202605281711.bSeZlErK-lkp@intel.com/config)
> > compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9409c07de6378507397ecdb6f05f628f58110112)
> > rustc: rustc 1.88.0 (6b00bc388 2025-06-23)
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281711.bSeZlErK-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/202605281711.bSeZlErK-lkp@intel.com/
> >
> > All errors (new ones prefixed by >>):
> >
> > >> mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> > 651 | __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries,
> > | ^
> > mm/memcontrol-v1.c:721:31: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
> > 721 | id = __swap_cgroup_clear(ci, swp_cluster_offset(folio->swap),
> > | ^
> > 2 errors generated.
>
> OK, CONFIG_SWAP=n.
I though we have already fixed this, and this is trigger by the bot
just because its not a squashed commit, so building while iterating
the commit will still fail? Or maybe I have some misunderstanding
here..
https://lore.kernel.org/linux-mm/20260519152620.b7b5fd2d68d635ec8d34ad2c@linux-foundation.org/
>
> We could hack in a stub for swp_cluster_offset(), but why are we
> compiling __memcg1_swapout() at all when CONFIG_SWAP=n? Ditto
> memcg1_swapin().
>
> How does the below look?
>
> Really this should be done as a preparatory thing, but we'll survive.
>
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: memcgv1: don't compile swap functions when CONFIG_SWAP=n
> Date: Thu May 28 02:35:22 PM PDT 2026
>
> Stub these out to save some dead code and to fix a build error with the
> upcoming "mm/memcg, swap: store cgroup id in cluster table directly".
>
> Link: https://lore.kernel.org/202605281711.bSeZlErK-lkp@intel.com
> Cc: David Hildenbrand <david@kernel.org>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Kairui Song <kasong@tencent.com>
> Cc: Michal Hocko <mhocko@kernel.org>
> Cc: Muchun Song <muchun.song@linux.dev>
> Cc: Roman Gushchin <roman.gushchin@linux.dev>
> Cc: Shakeel Butt <shakeel.butt@linux.dev>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> include/linux/memcontrol.h | 15 ++++++++++-----
> mm/memcontrol-v1.c | 2 ++
> 2 files changed, 12 insertions(+), 5 deletions(-)
>
> --- a/include/linux/memcontrol.h~mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix
> +++ a/include/linux/memcontrol.h
> @@ -1900,9 +1900,6 @@ static inline void mem_cgroup_exit_user_
> current->in_user_fault = 0;
> }
>
> -void __memcg1_swapout(struct folio *folio, struct swap_cluster_info *ci);
> -void memcg1_swapin(struct folio *folio);
> -
> #else /* CONFIG_MEMCG_V1 */
> static inline
> unsigned long memcg1_soft_limit_reclaim(pg_data_t *pgdat, int order,
> @@ -1930,6 +1927,15 @@ static inline void mem_cgroup_exit_user_
> {
> }
>
> +#endif /* CONFIG_MEMCG_V1 */
> +
> +#if defined(CONFIG_MEMCG_V1) && defined(CONFIG_SWAP)
> +
> +void __memcg1_swapout(struct folio *folio, struct swap_cluster_info *ci);
> +void memcg1_swapin(struct folio *folio);
> +
> +#else
> +
> static inline void __memcg1_swapout(struct folio *folio,
> struct swap_cluster_info *ci)
> {
> @@ -1938,7 +1944,6 @@ static inline void __memcg1_swapout(stru
> static inline void memcg1_swapin(struct folio *folio)
> {
> }
> -
> -#endif /* CONFIG_MEMCG_V1 */
> +#endif
>
> #endif /* _LINUX_MEMCONTROL_H */
> --- a/mm/memcontrol-v1.c~mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix
> +++ a/mm/memcontrol-v1.c
> @@ -604,6 +604,7 @@ void memcg1_commit_charge(struct folio *
> local_irq_restore(flags);
> }
>
> +#ifdef CONFIG_SWAP
> /**
> * __memcg1_swapout - transfer a memsw charge to swap
> * @folio: folio whose memsw charge to transfer
> @@ -723,6 +724,7 @@ void memcg1_swapin(struct folio *folio)
> swap_cluster_unlock(ci);
> mem_cgroup_uncharge_swap(id, nr_pages);
> }
> +#endif
>
> void memcg1_uncharge_batch(struct mem_cgroup *memcg, unsigned long pgpgout,
> unsigned long nr_memory, int nid)
> _
>
Thanks again, looks good to me, the simple is simple and it looks the
same thing I posted previously:
https://lore.kernel.org/linux-mm/ag0mdxBWcrZ8hxPP@KASONG-MC4/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-29 2:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 9:58 [akpm-mm:mm-unstable 199/420] mm/memcontrol-v1.c:651:24: error: call to undeclared function 'swp_cluster_offset'; ISO C99 and later do not support implicit function declarations kernel test robot
2026-05-28 21:45 ` Andrew Morton
2026-05-29 2:19 ` Kairui Song
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox