Re: [PATCH v3 18/20] memcg: swap: only charge physical swap slots
From: kernel test robot
Date: Sun Feb 08 2026 - 21:02:55 EST
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-19-nphamcs%40gmail.com
patch subject: [PATCH v3 18/20] memcg: swap: only charge physical swap slots
config: hexagon-randconfig-001-20260209 (https://download.01.org/0day-ci/archive/20260209/202602090941.opY2jzUD-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260209/202602090941.opY2jzUD-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202602090941.opY2jzUD-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
>> mm/memcontrol-v1.c:688:3: error: call to undeclared function 'mem_cgroup_clear_swap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
mem_cgroup_clear_swap(entry, nr_pages);
^
mm/memcontrol-v1.c:688:3: note: did you mean 'mem_cgroup_uncharge_swap'?
include/linux/swap.h:658:20: note: 'mem_cgroup_uncharge_swap' declared here
static inline void mem_cgroup_uncharge_swap(swp_entry_t entry,
^
1 error generated.
vim +/mem_cgroup_clear_swap +688 mm/memcontrol-v1.c
651
652 /*
653 * memcg1_swapin - uncharge swap slot
654 * @entry: the first swap entry for which the pages are charged
655 * @nr_pages: number of pages which will be uncharged
656 *
657 * Call this function after successfully adding the charged page to swapcache.
658 *
659 * Note: This function assumes the page for which swap slot is being uncharged
660 * is order 0 page.
661 */
662 void memcg1_swapin(swp_entry_t entry, unsigned int nr_pages)
663 {
664 /*
665 * Cgroup1's unified memory+swap counter has been charged with the
666 * new swapcache page, finish the transfer by uncharging the swap
667 * slot. The swap slot would also get uncharged when it dies, but
668 * it can stick around indefinitely and we'd count the page twice
669 * the entire time.
670 *
671 * Cgroup2 has separate resource counters for memory and swap,
672 * so this is a non-issue here. Memory and swap charge lifetimes
673 * correspond 1:1 to page and swap slot lifetimes: we charge the
674 * page to memory here, and uncharge swap when the slot is freed.
675 */
676 if (do_memsw_account()) {
677 /*
678 * The swap entry might not get freed for a long time,
679 * let's not wait for it. The page already received a
680 * memory+swap charge, drop the swap entry duplicate.
681 */
682 mem_cgroup_uncharge_swap(entry, nr_pages);
683
684 /*
685 * Clear the cgroup association now to prevent double memsw
686 * uncharging when the backends are released later.
687 */
> 688 mem_cgroup_clear_swap(entry, nr_pages);
689 }
690 }
691
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki