Re: [PATCH 06/12] mm, swap: implement helpers for reserving data in the swap table

From: Kairui Song

Date: Mon Jan 26 2026 - 03:28:53 EST


On Mon, Jan 26, 2026 at 3:16 PM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Kairui,
>
> kernel test robot noticed the following build errors:
>
> [auto build test ERROR on 10de4550639e9df9242e32e9affc90ed75a27c7d]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Kairui-Song/mm-swap-protect-si-swap_file-properly-and-use-as-a-mount-indicator/20260126-020149
> base: 10de4550639e9df9242e32e9affc90ed75a27c7d
> patch link: https://lore.kernel.org/r/20260126-swap-table-p3-v1-6-a74155fab9b0%40tencent.com
> patch subject: [PATCH 06/12] mm, swap: implement helpers for reserving data in the swap table
> config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20260126/202601261555.3oBvFZIt-lkp@xxxxxxxxx/config)
> compiler: arc-linux-gcc (GCC) 15.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260126/202601261555.3oBvFZIt-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/202601261555.3oBvFZIt-lkp@xxxxxxxxx/
>
> All errors (new ones prefixed by >>):
>
> In file included from <command-line>:
> In function 'pfn_to_swp_tb',
> inlined from 'folio_to_swp_tb' at mm/swap_table.h:115:9,
> inlined from '__swap_cache_add_folio' at mm/swap_state.c:151:11:
> >> include/linux/compiler_types.h:631:45: error: call to '__compiletime_assert_601' declared with attribute error: BUILD_BUG_ON failed: SWAP_CACHE_PFN_BITS > (BITS_PER_LONG - SWP_TB_PFN_MARK_BITS - SWP_TB_COUNT_BITS)

So IIUC ARC may have MAX_POSSIBLE_PHYSMEM_BITS == 40 with PAGE_SHIFT
== 13, BITS_PER_LONG == 32. So SWAP_CACHE_PFN_BITS has to be shrunk to
3 on that arch (Currently SWAP_CACHE_PFN_BITS == 4). That is
acceptable, swap count value beyond (1 << 3) is still offloaded to the
extended table just fine and that's the unlikely case.

I'll update the macro definitions to let SWAP_CACHE_PFN_BITS shrink
automatically when there are not enough bits, and trigger a build
error if SWAP_CACHE_PFN_BITS <= 1, and test the ARC build.