* [akpm-mm:mm-new 323/362] mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset'
@ 2026-05-19 22:16 kernel test robot
2026-05-19 22:26 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2026-05-19 22:16 UTC (permalink / raw)
To: Kairui Song
Cc: 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-new
head: ac33089a65a951edf4365b1ff7fbe5b5e8062d06
commit: dc1675a14ba774891fdf5212b7bedc7f50661862 [323/362] mm/memcg, swap: store cgroup id in cluster table directly
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20260520/202605200624.e9eMvkBW-lkp@intel.com/config)
compiler: sh4-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260520/202605200624.e9eMvkBW-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/202605200624.e9eMvkBW-lkp@intel.com/
All errors (new ones prefixed by >>):
mm/memcontrol-v1.c: In function '__memcg1_swapout':
>> mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' [-Wimplicit-function-declaration]
651 | __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries,
| ^~~~~~~~~~~~~~~~~~
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-new 323/362] mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' 2026-05-19 22:16 [akpm-mm:mm-new 323/362] mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' kernel test robot @ 2026-05-19 22:26 ` Andrew Morton 2026-05-20 6:23 ` Kairui Song 0 siblings, 1 reply; 3+ messages in thread From: Andrew Morton @ 2026-05-19 22:26 UTC (permalink / raw) To: kernel test robot Cc: Kairui Song, oe-kbuild-all, David Hildenbrand, Linux Memory Management List, mm-commits On Wed, 20 May 2026 06:16:25 +0800 kernel test robot <lkp@intel.com> wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new > head: ac33089a65a951edf4365b1ff7fbe5b5e8062d06 > commit: dc1675a14ba774891fdf5212b7bedc7f50661862 [323/362] mm/memcg, swap: store cgroup id in cluster table directly > config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20260520/202605200624.e9eMvkBW-lkp@intel.com/config) > compiler: sh4-linux-gcc (GCC) 15.2.0 > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260520/202605200624.e9eMvkBW-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/202605200624.e9eMvkBW-lkp@intel.com/ > > All errors (new ones prefixed by >>): > > mm/memcontrol-v1.c: In function '__memcg1_swapout': > >> mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' [-Wimplicit-function-declaration] > 651 | __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries, > | ^~~~~~~~~~~~~~~~~~ Thanks. I added the below to fix the build, but I've no reason to believe that it's correct. From: Andrew Morton <akpm@linux-foundation.org> Subject: mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix Date: Tue May 19 03:23:38 PM PDT 2026 "fix" CONFIG_SWAP=n build Cc: Baolin Wang <baolin.wang@linux.alibaba.com> Cc: Baoquan He <bhe@redhat.com> Cc: Barry Song <baohua@kernel.org> Cc: Chengming Zhou <chengming.zhou@linux.dev> Cc: Chris Li <chrisl@kernel.org> Cc: David Hildenbrand <david@kernel.org> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Kairui Song <kasong@tencent.com> Cc: Kemeng Shi <shikemeng@huaweicloud.com> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Nhat Pham <nphamcs@gmail.com> Cc: Roman Gushchin <roman.gushchin@linux.dev> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Youngjun Park <youngjun.park@lge.com> Cc: Zi Yan <ziy@nvidia.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> --- mm/swap.h | 6 ++++++ 1 file changed, 6 insertions(+) --- a/mm/swap.h~mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix +++ a/mm/swap.h @@ -482,5 +482,11 @@ static inline int swap_zeromap_batch(swp { return 0; } + +static inline unsigned int swp_cluster_offset(swp_entry_t entry) +{ + return 0; +} + #endif /* CONFIG_SWAP */ #endif /* _MM_SWAP_H */ _ ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [akpm-mm:mm-new 323/362] mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' 2026-05-19 22:26 ` Andrew Morton @ 2026-05-20 6:23 ` Kairui Song 0 siblings, 0 replies; 3+ messages in thread From: Kairui Song @ 2026-05-20 6:23 UTC (permalink / raw) To: Andrew Morton Cc: kernel test robot, Kairui Song, oe-kbuild-all, David Hildenbrand, Linux Memory Management List, mm-commits On Tue, May 19, 2026 at 03:26:20PM +0800, Andrew Morton wrote: > On Wed, 20 May 2026 06:16:25 +0800 kernel test robot <lkp@intel.com> wrote: > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new > > head: ac33089a65a951edf4365b1ff7fbe5b5e8062d06 > > commit: dc1675a14ba774891fdf5212b7bedc7f50661862 [323/362] mm/memcg, swap: store cgroup id in cluster table directly > > config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20260520/202605200624.e9eMvkBW-lkp@intel.com/config) > > compiler: sh4-linux-gcc (GCC) 15.2.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260520/202605200624.e9eMvkBW-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/202605200624.e9eMvkBW-lkp@intel.com/ > > > > All errors (new ones prefixed by >>): > > > > mm/memcontrol-v1.c: In function '__memcg1_swapout': > > >> mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' [-Wimplicit-function-declaration] > > 651 | __swap_cgroup_set(ci, swp_cluster_offset(folio->swap), nr_entries, > > | ^~~~~~~~~~~~~~~~~~ > > Thanks. I added the below to fix the build, but I've no reason to > believe that it's correct. > > From: Andrew Morton <akpm@linux-foundation.org> > Subject: mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix > Date: Tue May 19 03:23:38 PM PDT 2026 > > "fix" CONFIG_SWAP=n build > > Cc: Baolin Wang <baolin.wang@linux.alibaba.com> > Cc: Baoquan He <bhe@redhat.com> > Cc: Barry Song <baohua@kernel.org> > Cc: Chengming Zhou <chengming.zhou@linux.dev> > Cc: Chris Li <chrisl@kernel.org> > Cc: David Hildenbrand <david@kernel.org> > Cc: Hugh Dickins <hughd@google.com> > Cc: Johannes Weiner <hannes@cmpxchg.org> > Cc: Kairui Song <kasong@tencent.com> > Cc: Kemeng Shi <shikemeng@huaweicloud.com> > Cc: Lorenzo Stoakes <ljs@kernel.org> > Cc: Muchun Song <muchun.song@linux.dev> > Cc: Nhat Pham <nphamcs@gmail.com> > Cc: Roman Gushchin <roman.gushchin@linux.dev> > Cc: Shakeel Butt <shakeel.butt@linux.dev> > Cc: Youngjun Park <youngjun.park@lge.com> > Cc: Zi Yan <ziy@nvidia.com> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org> > --- > > mm/swap.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > --- a/mm/swap.h~mm-memcg-swap-store-cgroup-id-in-cluster-table-directly-fix > +++ a/mm/swap.h > @@ -482,5 +482,11 @@ static inline int swap_zeromap_batch(swp > { > return 0; > } > + > +static inline unsigned int swp_cluster_offset(swp_entry_t entry) > +{ > + return 0; > +} > + > #endif /* CONFIG_SWAP */ > #endif /* _MM_SWAP_H */ > _ > Thanks for the fix, this is not wrong at the moment, memcg1's swap code is dead code with !CONFIG_SWAP so filling anything there is fine. I didn't notice that memcg1 won't filter out the swap code when !CONFIG_SWAP. So following patch should be better: Just eliminate the dead code. It should be put before this series, there will be a minor conflict in memcontrol.h as a few declarations are moved by this, but should be easy to solve. I can send a rebased version of this series if the conflict is too trouble some to solve, or we can clean this up later and just keep this dummy swp_cluster_offset for now. From 55dd3196e47f3d148edb01f2a37057e6af4bcdaf Mon Sep 17 00:00:00 2001 From: Kairui Song <kasong@tencent.com> Date: Wed, 20 May 2026 11:14:13 +0800 Subject: [PATCH] mm/memcg: v1: guard swap helpers under CONFIG_SWAP These helpers are essentially dead weight when CONFIG_SWAP is disabled, so just guard them with the right ifdef, we will have a smaller vmlinux: ./scripts/bloat-o-meter mm/memcontrol-v1.o.old mm/memcontrol-v1.o add/remove: 0/3 grow/shrink: 0/0 up/down: 0/-473 (-473) Function old new delta __UNIQUE_ID_addressable___SCK__preempt_schedule_53 8 - -8 memcg1_swapin 12 - -12 memcg1_swapout 453 - -453 Total: Before=17932, After=17459, chg -2.64% Signed-off-by: Kairui Song <kasong@tencent.com> --- include/linux/memcontrol.h | 11 ++++++----- mm/memcontrol-v1.c | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index dc3fa687759b..1e02f0afecb6 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1899,9 +1899,6 @@ static inline void mem_cgroup_exit_user_fault(void) current->in_user_fault = 0; } -void memcg1_swapout(struct folio *folio, swp_entry_t entry); -void memcg1_swapin(swp_entry_t entry, unsigned int nr_pages); - #else /* CONFIG_MEMCG_V1 */ static inline unsigned long memcg1_soft_limit_reclaim(pg_data_t *pgdat, int order, @@ -1928,7 +1925,12 @@ static inline void mem_cgroup_enter_user_fault(void) static inline void mem_cgroup_exit_user_fault(void) { } +#endif /* CONFIG_MEMCG_V1 */ +#if defined(CONFIG_SWAP) && defined(CONFIG_MEMCG_V1) +void memcg1_swapout(struct folio *folio, swp_entry_t entry); +void memcg1_swapin(swp_entry_t entry, unsigned int nr_pages); +#else static inline void memcg1_swapout(struct folio *folio, swp_entry_t entry) { } @@ -1936,7 +1938,6 @@ static inline void memcg1_swapout(struct folio *folio, swp_entry_t entry) static inline void memcg1_swapin(swp_entry_t entry, unsigned int nr_pages) { } - -#endif /* CONFIG_MEMCG_V1 */ +#endif #endif /* _LINUX_MEMCONTROL_H */ diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c index 433bba9dfe71..8fb02dc5b259 100644 --- a/mm/memcontrol-v1.c +++ b/mm/memcontrol-v1.c @@ -603,6 +603,7 @@ void memcg1_commit_charge(struct folio *folio, struct mem_cgroup *memcg) local_irq_restore(flags); } +#ifdef CONFIG_SWAP /** * memcg1_swapout - transfer a memsw charge to swap * @folio: folio whose memsw charge to transfer @@ -704,6 +705,7 @@ void memcg1_swapin(swp_entry_t entry, unsigned int nr_pages) mem_cgroup_uncharge_swap(entry, nr_pages); } } +#endif /* CONFIG_SWAP */ void memcg1_uncharge_batch(struct mem_cgroup *memcg, unsigned long pgpgout, unsigned long nr_memory, int nid) -- 2.54.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-20 6:23 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-19 22:16 [akpm-mm:mm-new 323/362] mm/memcontrol-v1.c:651:31: error: implicit declaration of function 'swp_cluster_offset' kernel test robot 2026-05-19 22:26 ` Andrew Morton 2026-05-20 6:23 ` Kairui Song
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.