Re: [kbuild-all] Re: mm/khugepaged.c:2046:56: warning: 'struct khugepaged_mm_slot' declared inside parameter list will not be visible outside of this definition or declaration

From: Chen, Rong A
Date: Sun Sep 04 2022 - 22:02:17 EST




On 9/2/2022 11:37 PM, Qi Zheng wrote:


On 2022/9/2 22:23, kernel test robot wrote:
tree: https://github.com/intel-lab-lkp/linux/commits/UPDATE-20220901-154717/Qi-Zheng/add-common-struct-mm_slot-and-use-it-in-THP-and-KSM/20220831-112149
head:   32b787e37af17f7fe75f9b9c9bb22bf044722229
commit: 7ad02cf1645071c2bf1ed6ae0e48907aa0a3119e mm: thp: fix build error with CONFIG_SHMEM disabled
date:   30 hours ago
config: sparc-randconfig-r023-20220901 (https://download.01.org/0day-ci/archive/20220902/202209022248.TEjW4Cld-lkp@xxxxxxxxx/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
         chmod +x ~/bin/make.cross
         # https://github.com/intel-lab-lkp/linux/commit/7ad02cf1645071c2bf1ed6ae0e48907aa0a3119e
         git remote add linux-review https://github.com/intel-lab-lkp/linux
         git fetch --no-tags linux-review UPDATE-20220901-154717/Qi-Zheng/add-common-struct-mm_slot-and-use-it-in-THP-and-KSM/20220831-112149
         git checkout 7ad02cf1645071c2bf1ed6ae0e48907aa0a3119e
         # save the config file
         mkdir build_dir && cp config build_dir/.config
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

mm/khugepaged.c:2046:56: warning: 'struct khugepaged_mm_slot' declared inside parameter list will not be visible outside of this definition or declaration
     2046 | static void khugepaged_collapse_pte_mapped_thps(struct khugepaged_mm_slot *mm_slot)
          | ^~~~~~~~~~~~~~~~~~
    mm/khugepaged.c: In function 'khugepaged_scan_mm_slot':
    mm/khugepaged.c:2076:45: error: passing argument 1 of 'khugepaged_collapse_pte_mapped_thps' from incompatible pointer type [-Werror=incompatible-pointer-types]
     2076 |         khugepaged_collapse_pte_mapped_thps(mm_slot);
          |                                             ^~~~~~~
          |                                             |
          |                                             struct mm_slot *

It looks like the robot tested "mm: thp: fix build error with
CONFIG_SHMEM disabled" alone without "[PATCH v2 2/7] mm: thp: convert to
use common struct mm_slot". So this is a false positive.

Hi Qi,

Thanks for the explanation, you are right, the robot was considered this
patch as a replacement of "[PATCH v2 2/7] mm: thp: convert to use common
struct mm_slot".

Best Regards,
Rong Chen


    mm/khugepaged.c:2046:76: note: expected 'struct khugepaged_mm_slot *' but argument is of type 'struct mm_slot *'
     2046 | static void khugepaged_collapse_pte_mapped_thps(struct khugepaged_mm_slot *mm_slot)
          | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
    cc1: some warnings being treated as errors


vim +2046 mm/khugepaged.c

   2045
2046    static void khugepaged_collapse_pte_mapped_thps(struct khugepaged_mm_slot *mm_slot)
   2047    {
   2048    }
   2049    #endif
   2050