Re: [PATCH v3 09/12] mm, swap: use the swap table to track the swap count
From: kernel test robot
Date: Wed Feb 18 2026 - 05:42:17 EST
Hi Kairui,
kernel test robot noticed the following build warnings:
[auto build test WARNING on d9982f38eb6e9a0cb6bdd1116cc87f75a1084aad]
url: https://github.com/intel-lab-lkp/linux/commits/Kairui-Song-via-B4-Relay/mm-swap-protect-si-swap_file-properly-and-use-as-a-mount-indicator/20260218-040852
base: d9982f38eb6e9a0cb6bdd1116cc87f75a1084aad
patch link: https://lore.kernel.org/r/20260218-swap-table-p3-v3-9-f4e34be021a7%40tencent.com
patch subject: [PATCH v3 09/12] mm, swap: use the swap table to track the swap count
config: i386-buildonly-randconfig-001-20260218 (https://download.01.org/0day-ci/archive/20260218/202602181835.58TEynxc-lkp@xxxxxxxxx/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260218/202602181835.58TEynxc-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/202602181835.58TEynxc-lkp@xxxxxxxxx/
All warnings (new ones prefixed by >>):
>> mm/swapfile.c:1627:6: warning: shift count >= width of type [-Wshift-count-overflow]
1626 | VM_WARN_ON_ONCE(ci->extend_table[ci_off] >=
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1627 | (BIT(BITS_PER_TYPE(ci->extend_table[0]))) - 1);
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
7 | #define BIT(nr) (UL(1) << (nr))
| ^
include/linux/mmdebug.h:123:50: note: expanded from macro 'VM_WARN_ON_ONCE'
123 | #define VM_WARN_ON_ONCE(cond) (void)WARN_ON_ONCE(cond)
| ~~~~~~~~~~~~~^~~~~
include/asm-generic/bug.h:120:25: note: expanded from macro 'WARN_ON_ONCE'
120 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
1 warning generated.
vim +1627 mm/swapfile.c
1596
1597 /* Increase the swap count of one slot. */
1598 static int __swap_cluster_dup_entry(struct swap_cluster_info *ci,
1599 unsigned int ci_off)
1600 {
1601 int count;
1602 unsigned long swp_tb;
1603
1604 lockdep_assert_held(&ci->lock);
1605 swp_tb = __swap_table_get(ci, ci_off);
1606 /* Bad or special slots can't be handled */
1607 if (WARN_ON_ONCE(swp_tb_is_bad(swp_tb)))
1608 return -EINVAL;
1609 count = __swp_tb_get_count(swp_tb);
1610 /* Must be either cached or have a count already */
1611 if (WARN_ON_ONCE(!count && !swp_tb_is_folio(swp_tb)))
1612 return -ENOENT;
1613
1614 if (likely(count < (SWP_TB_COUNT_MAX - 1))) {
1615 __swap_table_set(ci, ci_off, __swp_tb_mk_count(swp_tb, count + 1));
1616 VM_WARN_ON_ONCE(ci->extend_table && ci->extend_table[ci_off]);
1617 } else if (count == (SWP_TB_COUNT_MAX - 1)) {
1618 if (ci->extend_table) {
1619 VM_WARN_ON_ONCE(ci->extend_table[ci_off]);
1620 ci->extend_table[ci_off] = SWP_TB_COUNT_MAX;
1621 __swap_table_set(ci, ci_off, __swp_tb_mk_count(swp_tb, SWP_TB_COUNT_MAX));
1622 } else {
1623 return -ENOMEM;
1624 }
1625 } else if (count == SWP_TB_COUNT_MAX) {
1626 VM_WARN_ON_ONCE(ci->extend_table[ci_off] >=
> 1627 (BIT(BITS_PER_TYPE(ci->extend_table[0]))) - 1);
1628 ++ci->extend_table[ci_off];
1629 } else {
1630 /* Never happens unless counting went wrong */
1631 WARN_ON_ONCE(1);
1632 }
1633
1634 return 0;
1635 }
1636
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki