Re: [PATCH v2 17/20] mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc

Nathan Chancellor
2024-07-05T17:15:56Z

On Fri, Jul 05, 2024 at 10:43:41PM +0800, kernel test robot wrote:
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on akpm-mm/mm-everything]
>
> url: https://github.com/intel-lab-lkp/linux/commits/alexs-kernel-org/mm-zsmalloc-add-zpdesc-memory-descriptor-for-zswap-zpool/20240703-182314
> base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
> patch link: https://lore.kernel.org/r/20240703040613.681396-18-alexs%40kernel.org
> patch subject: [PATCH v2 17/20] mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc
> config: i386-randconfig-002-20240705 (https://download.01.org/0day-ci/archive/20240705/202407052102.qbT7nLMK-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240705/202407052102.qbT7nLMK-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/202407052102.qbT7nLMK-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> mm/zsmalloc.c:471:12: warning: function 'is_first_zpdesc' is not needed and will not be emitted [-Wunneeded-internal-declaration]
> 471 | static int is_first_zpdesc(struct zpdesc *zpdesc)
> | ^~~~~~~~~~~~~~~
> 1 warning generated.

I am not sure why the robot thinks that this change introduced this
warning, I think it has been present since patch 2 of this series.

The warning occurs when CONFIG_DEBUG_VM is disabled because
is_first_zpdesc() is used with VM_BUG_ON_PAGE, which ultimately
evaluates to BUILD_BUG_ON_INVALID() / sizeof(), so is_first_zpdesc() is
only used in a compile time context for this configuration. Perhaps this
can just be marked as __maybe_unused?

Cheers,
Nathan