Re: [PATCH 1/5] mm: move some shrinker-related function declarations to mm/internal.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Qi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on brauner-vfs/vfs.all]
[also build test WARNING on linus/master v6.5-rc6 next-20230816]
[cannot apply to akpm-mm/mm-everything drm-misc/drm-misc-next vfs-idmapping/for-next]
[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/Qi-Zheng/mm-move-some-shrinker-related-function-declarations-to-mm-internal-h/20230816-163833
base:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all
patch link:    https://lore.kernel.org/r/20230816083419.41088-2-zhengqi.arch%40bytedance.com
patch subject: [PATCH 1/5] mm: move some shrinker-related function declarations to mm/internal.h
config: riscv-randconfig-r015-20230816 (https://download.01.org/0day-ci/archive/20230816/202308162118.motJd6aG-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230816/202308162118.motJd6aG-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/202308162118.motJd6aG-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

                                            ~~~~~~~~~~ ^
   In file included from mm/shrinker_debug.c:7:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:751:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           insw(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:105:53: note: expanded from macro 'insw'
   #define insw(addr, buffer, count) __insw(PCI_IOBASE + (addr), buffer, count)
                                            ~~~~~~~~~~ ^
   In file included from mm/shrinker_debug.c:7:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:759:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           insl(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:106:53: note: expanded from macro 'insl'
   #define insl(addr, buffer, count) __insl(PCI_IOBASE + (addr), buffer, count)
                                            ~~~~~~~~~~ ^
   In file included from mm/shrinker_debug.c:7:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:768:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           outsb(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:118:55: note: expanded from macro 'outsb'
   #define outsb(addr, buffer, count) __outsb(PCI_IOBASE + (addr), buffer, count)
                                              ~~~~~~~~~~ ^
   In file included from mm/shrinker_debug.c:7:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:777:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           outsw(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:119:55: note: expanded from macro 'outsw'
   #define outsw(addr, buffer, count) __outsw(PCI_IOBASE + (addr), buffer, count)
                                              ~~~~~~~~~~ ^
   In file included from mm/shrinker_debug.c:7:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:786:2: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           outsl(addr, buffer, count);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/io.h:120:55: note: expanded from macro 'outsl'
   #define outsl(addr, buffer, count) __outsl(PCI_IOBASE + (addr), buffer, count)
                                              ~~~~~~~~~~ ^
   In file included from mm/shrinker_debug.c:7:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:1134:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
                                                     ~~~~~~~~~~ ^
>> mm/shrinker_debug.c:174:5: warning: no previous prototype for function 'shrinker_debugfs_add' [-Wmissing-prototypes]
   int shrinker_debugfs_add(struct shrinker *shrinker)
       ^
   mm/shrinker_debug.c:174:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int shrinker_debugfs_add(struct shrinker *shrinker)
   ^
   static 
>> mm/shrinker_debug.c:249:16: warning: no previous prototype for function 'shrinker_debugfs_detach' [-Wmissing-prototypes]
   struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker,
                  ^
   mm/shrinker_debug.c:249:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker,
   ^
   static 
>> mm/shrinker_debug.c:265:6: warning: no previous prototype for function 'shrinker_debugfs_remove' [-Wmissing-prototypes]
   void shrinker_debugfs_remove(struct dentry *debugfs_entry, int debugfs_id)
        ^
   mm/shrinker_debug.c:265:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void shrinker_debugfs_remove(struct dentry *debugfs_entry, int debugfs_id)
   ^
   static 
   16 warnings generated.


vim +/shrinker_debugfs_add +174 mm/shrinker_debug.c

bbf535fd6f06b94 Roman Gushchin     2022-05-31  173  
5035ebc644aec92 Roman Gushchin     2022-05-31 @174  int shrinker_debugfs_add(struct shrinker *shrinker)
5035ebc644aec92 Roman Gushchin     2022-05-31  175  {
5035ebc644aec92 Roman Gushchin     2022-05-31  176  	struct dentry *entry;
e33c267ab70de42 Roman Gushchin     2022-05-31  177  	char buf[128];
5035ebc644aec92 Roman Gushchin     2022-05-31  178  	int id;
5035ebc644aec92 Roman Gushchin     2022-05-31  179  
47a7c01c3efc658 Qi Zheng           2023-06-09  180  	lockdep_assert_held(&shrinker_rwsem);
5035ebc644aec92 Roman Gushchin     2022-05-31  181  
5035ebc644aec92 Roman Gushchin     2022-05-31  182  	/* debugfs isn't initialized yet, add debugfs entries later. */
5035ebc644aec92 Roman Gushchin     2022-05-31  183  	if (!shrinker_debugfs_root)
5035ebc644aec92 Roman Gushchin     2022-05-31  184  		return 0;
5035ebc644aec92 Roman Gushchin     2022-05-31  185  
5035ebc644aec92 Roman Gushchin     2022-05-31  186  	id = ida_alloc(&shrinker_debugfs_ida, GFP_KERNEL);
5035ebc644aec92 Roman Gushchin     2022-05-31  187  	if (id < 0)
5035ebc644aec92 Roman Gushchin     2022-05-31  188  		return id;
5035ebc644aec92 Roman Gushchin     2022-05-31  189  	shrinker->debugfs_id = id;
5035ebc644aec92 Roman Gushchin     2022-05-31  190  
e33c267ab70de42 Roman Gushchin     2022-05-31  191  	snprintf(buf, sizeof(buf), "%s-%d", shrinker->name, id);
5035ebc644aec92 Roman Gushchin     2022-05-31  192  
5035ebc644aec92 Roman Gushchin     2022-05-31  193  	/* create debugfs entry */
5035ebc644aec92 Roman Gushchin     2022-05-31  194  	entry = debugfs_create_dir(buf, shrinker_debugfs_root);
5035ebc644aec92 Roman Gushchin     2022-05-31  195  	if (IS_ERR(entry)) {
5035ebc644aec92 Roman Gushchin     2022-05-31  196  		ida_free(&shrinker_debugfs_ida, id);
5035ebc644aec92 Roman Gushchin     2022-05-31  197  		return PTR_ERR(entry);
5035ebc644aec92 Roman Gushchin     2022-05-31  198  	}
5035ebc644aec92 Roman Gushchin     2022-05-31  199  	shrinker->debugfs_entry = entry;
5035ebc644aec92 Roman Gushchin     2022-05-31  200  
2124f79de6a9096 John Keeping       2023-04-18  201  	debugfs_create_file("count", 0440, entry, shrinker,
5035ebc644aec92 Roman Gushchin     2022-05-31  202  			    &shrinker_debugfs_count_fops);
2124f79de6a9096 John Keeping       2023-04-18  203  	debugfs_create_file("scan", 0220, entry, shrinker,
bbf535fd6f06b94 Roman Gushchin     2022-05-31  204  			    &shrinker_debugfs_scan_fops);
5035ebc644aec92 Roman Gushchin     2022-05-31  205  	return 0;
5035ebc644aec92 Roman Gushchin     2022-05-31  206  }
5035ebc644aec92 Roman Gushchin     2022-05-31  207  
e33c267ab70de42 Roman Gushchin     2022-05-31  208  int shrinker_debugfs_rename(struct shrinker *shrinker, const char *fmt, ...)
e33c267ab70de42 Roman Gushchin     2022-05-31  209  {
e33c267ab70de42 Roman Gushchin     2022-05-31  210  	struct dentry *entry;
e33c267ab70de42 Roman Gushchin     2022-05-31  211  	char buf[128];
e33c267ab70de42 Roman Gushchin     2022-05-31  212  	const char *new, *old;
e33c267ab70de42 Roman Gushchin     2022-05-31  213  	va_list ap;
e33c267ab70de42 Roman Gushchin     2022-05-31  214  	int ret = 0;
e33c267ab70de42 Roman Gushchin     2022-05-31  215  
e33c267ab70de42 Roman Gushchin     2022-05-31  216  	va_start(ap, fmt);
e33c267ab70de42 Roman Gushchin     2022-05-31  217  	new = kvasprintf_const(GFP_KERNEL, fmt, ap);
e33c267ab70de42 Roman Gushchin     2022-05-31  218  	va_end(ap);
e33c267ab70de42 Roman Gushchin     2022-05-31  219  
e33c267ab70de42 Roman Gushchin     2022-05-31  220  	if (!new)
e33c267ab70de42 Roman Gushchin     2022-05-31  221  		return -ENOMEM;
e33c267ab70de42 Roman Gushchin     2022-05-31  222  
47a7c01c3efc658 Qi Zheng           2023-06-09  223  	down_write(&shrinker_rwsem);
e33c267ab70de42 Roman Gushchin     2022-05-31  224  
e33c267ab70de42 Roman Gushchin     2022-05-31  225  	old = shrinker->name;
e33c267ab70de42 Roman Gushchin     2022-05-31  226  	shrinker->name = new;
e33c267ab70de42 Roman Gushchin     2022-05-31  227  
e33c267ab70de42 Roman Gushchin     2022-05-31  228  	if (shrinker->debugfs_entry) {
e33c267ab70de42 Roman Gushchin     2022-05-31  229  		snprintf(buf, sizeof(buf), "%s-%d", shrinker->name,
e33c267ab70de42 Roman Gushchin     2022-05-31  230  			 shrinker->debugfs_id);
e33c267ab70de42 Roman Gushchin     2022-05-31  231  
e33c267ab70de42 Roman Gushchin     2022-05-31  232  		entry = debugfs_rename(shrinker_debugfs_root,
e33c267ab70de42 Roman Gushchin     2022-05-31  233  				       shrinker->debugfs_entry,
e33c267ab70de42 Roman Gushchin     2022-05-31  234  				       shrinker_debugfs_root, buf);
e33c267ab70de42 Roman Gushchin     2022-05-31  235  		if (IS_ERR(entry))
e33c267ab70de42 Roman Gushchin     2022-05-31  236  			ret = PTR_ERR(entry);
e33c267ab70de42 Roman Gushchin     2022-05-31  237  		else
e33c267ab70de42 Roman Gushchin     2022-05-31  238  			shrinker->debugfs_entry = entry;
e33c267ab70de42 Roman Gushchin     2022-05-31  239  	}
e33c267ab70de42 Roman Gushchin     2022-05-31  240  
47a7c01c3efc658 Qi Zheng           2023-06-09  241  	up_write(&shrinker_rwsem);
e33c267ab70de42 Roman Gushchin     2022-05-31  242  
e33c267ab70de42 Roman Gushchin     2022-05-31  243  	kfree_const(old);
e33c267ab70de42 Roman Gushchin     2022-05-31  244  
e33c267ab70de42 Roman Gushchin     2022-05-31  245  	return ret;
e33c267ab70de42 Roman Gushchin     2022-05-31  246  }
e33c267ab70de42 Roman Gushchin     2022-05-31  247  EXPORT_SYMBOL(shrinker_debugfs_rename);
e33c267ab70de42 Roman Gushchin     2022-05-31  248  
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03 @249  struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker,
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  250  				       int *debugfs_id)
5035ebc644aec92 Roman Gushchin     2022-05-31  251  {
badc28d4924bfed Qi Zheng           2023-02-02  252  	struct dentry *entry = shrinker->debugfs_entry;
badc28d4924bfed Qi Zheng           2023-02-02  253  
47a7c01c3efc658 Qi Zheng           2023-06-09  254  	lockdep_assert_held(&shrinker_rwsem);
5035ebc644aec92 Roman Gushchin     2022-05-31  255  
e33c267ab70de42 Roman Gushchin     2022-05-31  256  	kfree_const(shrinker->name);
14773bfa70e67f4 Tetsuo Handa       2022-07-20  257  	shrinker->name = NULL;
e33c267ab70de42 Roman Gushchin     2022-05-31  258  
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  259  	*debugfs_id = entry ? shrinker->debugfs_id : -1;
badc28d4924bfed Qi Zheng           2023-02-02  260  	shrinker->debugfs_entry = NULL;
badc28d4924bfed Qi Zheng           2023-02-02  261  
badc28d4924bfed Qi Zheng           2023-02-02  262  	return entry;
5035ebc644aec92 Roman Gushchin     2022-05-31  263  }
5035ebc644aec92 Roman Gushchin     2022-05-31  264  
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03 @265  void shrinker_debugfs_remove(struct dentry *debugfs_entry, int debugfs_id)
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  266  {
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  267  	debugfs_remove_recursive(debugfs_entry);
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  268  	ida_free(&shrinker_debugfs_ida, debugfs_id);
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  269  }
26e239b37ebdfd1 Joan Bruguera Micó 2023-05-03  270  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux