linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Qi Zheng <zhengqi.arch@bytedance.com>
To: kernel test robot <lkp@intel.com>,
	akpm@linux-foundation.org, david@fromorbit.com, tkhai@ya.ru,
	vbabka@suse.cz, roman.gushchin@linux.dev, djwong@kernel.org,
	brauner@kernel.org, paulmck@kernel.org, tytso@mit.edu,
	steven.price@arm.com, cel@kernel.org, senozhatsky@chromium.org,
	yujie.liu@intel.com, gregkh@linuxfoundation.org,
	muchun.song@linux.dev, joel@joelfernandes.org,
	christian.koenig@amd.com
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, dri-devel@lists.freedesktop.org,
	linux-fsdevel@vger.kernel.org,
	Muchun Song <songmuchun@bytedance.com>
Subject: Re: [PATCH 1/5] mm: move some shrinker-related function declarations to mm/internal.h
Date: Thu, 17 Aug 2023 11:04:10 +0800	[thread overview]
Message-ID: <52cc55b1-2584-9314-323d-4e407c66399a@bytedance.com> (raw)
In-Reply-To: <202308162208.cQBnGoER-lkp@intel.com>



On 2023/8/16 23:01, kernel test robot wrote:
> 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: x86_64-buildonly-randconfig-r003-20230816 (https://download.01.org/0day-ci/archive/20230816/202308162208.cQBnGoER-lkp@intel.com/config)
> compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
> reproduce: (https://download.01.org/0day-ci/archive/20230816/202308162208.cQBnGoER-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/202308162208.cQBnGoER-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>>> mm/shrinker_debug.c:174:5: warning: no previous declaration for 'shrinker_debugfs_add' [-Wmissing-declarations]
>      int shrinker_debugfs_add(struct shrinker *shrinker)
>          ^~~~~~~~~~~~~~~~~~~~
>>> mm/shrinker_debug.c:249:16: warning: no previous declaration for 'shrinker_debugfs_detach' [-Wmissing-declarations]
>      struct dentry *shrinker_debugfs_detach(struct shrinker *shrinker,
>                     ^~~~~~~~~~~~~~~~~~~~~~~
>>> mm/shrinker_debug.c:265:6: warning: no previous declaration for 'shrinker_debugfs_remove' [-Wmissing-declarations]
>      void shrinker_debugfs_remove(struct dentry *debugfs_entry, int debugfs_id)
>           ^~~~~~~~~~~~~~~~~~~~~~~

Compiling with W=1 will report this warning, will fix it by including
"internal.h" in the mm/shrinker_debug.c.

Thanks,
Qi

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


  reply	other threads:[~2023-08-17  3:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  8:34 [PATCH 0/5] use refcount+RCU method to implement lockless slab shrink (part 1) Qi Zheng
2023-08-16  8:34 ` [PATCH 1/5] mm: move some shrinker-related function declarations to mm/internal.h Qi Zheng
2023-08-16 13:14   ` kernel test robot
2023-08-16 13:57   ` kernel test robot
2023-08-16 15:01   ` kernel test robot
2023-08-17  3:04     ` Qi Zheng [this message]
2023-08-16  8:34 ` [PATCH 2/5] mm: vmscan: move shrinker-related code into a separate file Qi Zheng
2023-08-16  8:34 ` [PATCH 3/5] mm: shrinker: remove redundant shrinker_rwsem in debugfs operations Qi Zheng
2023-08-16  8:34 ` [PATCH 4/5] drm/ttm: introduce pool_shrink_rwsem Qi Zheng
2023-08-16  9:14   ` Christian König
2023-08-16  9:20     ` Qi Zheng
2023-08-16  8:34 ` [PATCH 5/5] mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred} Qi Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52cc55b1-2584-9314-323d-4e407c66399a@bytedance.com \
    --to=zhengqi.arch@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=cel@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=david@fromorbit.com \
    --cc=djwong@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joel@joelfernandes.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=muchun.song@linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=paulmck@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=senozhatsky@chromium.org \
    --cc=songmuchun@bytedance.com \
    --cc=steven.price@arm.com \
    --cc=tkhai@ya.ru \
    --cc=tytso@mit.edu \
    --cc=vbabka@suse.cz \
    --cc=yujie.liu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox