From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C47DC001E0 for ; Wed, 16 Aug 2023 13:15:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D282D8D0037; Wed, 16 Aug 2023 09:15:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD7A58D0001; Wed, 16 Aug 2023 09:15:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B9EE98D0037; Wed, 16 Aug 2023 09:15:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A80A78D0001 for ; Wed, 16 Aug 2023 09:15:41 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 75711A0F76 for ; Wed, 16 Aug 2023 13:15:41 +0000 (UTC) X-FDA: 81130014882.05.200072F Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by imf04.hostedemail.com (Postfix) with ESMTP id F21234001E for ; Wed, 16 Aug 2023 13:15:36 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=bo5lJa2U; spf=pass (imf04.hostedemail.com: domain of lkp@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1692191737; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LOP8cB3ThvABzz2eax21vvBvluvJ7QHLs8oUXkujT58=; b=GMdXzPfm7orvFKAKYJkva9u6NUuq91sO5ehE+gMVisubhJx6sFH5owFZUpyb3FSrCy54gs UfjRLYqhTkLtoigmLFDODQUlzyse+uN8uBQ1Wrhp09fSF15b/Cip9AAxqdBVnrmpl/iUgp 05Y1qf0k2mlryVL3rtA5LSLEkbbbofk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692191737; a=rsa-sha256; cv=none; b=jGQybodg1cxEd+U5swhQWhNaJmGxUB0IT45J+psKGy0toYxGc3ipX+DxG1XL6KDUtsEN5X QsLzmTTVMcLBw8hf2BOSTadLYmiHp7Lds2+PDawO7KDyr+RJWq7NubkIajblvOkzM2BgAw /4fknhaFcWYfsBqwpTpKs0FfipeID+8= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=bo5lJa2U; spf=pass (imf04.hostedemail.com: domain of lkp@intel.com designates 192.55.52.151 as permitted sender) smtp.mailfrom=lkp@intel.com; dmarc=pass (policy=none) header.from=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692191737; x=1723727737; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=CLai+YNN3OujjOwMSs+ewWzyb1YQrY4aGWQEsGhHt0M=; b=bo5lJa2UDXK+Y90wE9zrpYQGVFVXbbHReiFC6vQNwSBeNIHVx6bY+D9l W0gL9eoEZsSaRvahaoWHj08aehlvJXajb2O1LsRhHEMALm5Xc1yqKgdmx GeHnq4DmFxJFM3/HYc/z8QR6+bTA9k01P8xlbgK2XXjCyyoDYE8CMdLx9 xbmgZZWogn/xw0aqQIEvZqAscVxgatfl3AEv3cS0jiDe58LFzB/FSSWAr 4JFoOSMnUSe27fowoAlHGo0uFO4Z/SG8VzyjXKWfsGK+MMzM5sIVdW3qv EuSZijIvf/P6IEsJaT+CM2M8Chs6g5am6pIBnD0Rr/Ufu13aZLEHghIzX g==; X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="352854188" X-IronPort-AV: E=Sophos;i="6.01,177,1684825200"; d="scan'208";a="352854188" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Aug 2023 06:15:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10803"; a="734204567" X-IronPort-AV: E=Sophos;i="6.01,177,1684825200"; d="scan'208";a="734204567" Received: from lkp-server02.sh.intel.com (HELO a9caf1a0cf30) ([10.239.97.151]) by orsmga002.jf.intel.com with ESMTP; 16 Aug 2023 06:15:26 -0700 Received: from kbuild by a9caf1a0cf30 with local (Exim 4.96) (envelope-from ) id 1qWGMr-0000K0-29; Wed, 16 Aug 2023 13:15:22 +0000 Date: Wed, 16 Aug 2023 21:14:55 +0800 From: kernel test robot To: Qi Zheng , 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: llvm@lists.linux.dev, 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, Qi Zheng , Muchun Song Subject: Re: [PATCH 1/5] mm: move some shrinker-related function declarations to mm/internal.h Message-ID: <202308162118.motJd6aG-lkp@intel.com> References: <20230816083419.41088-2-zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230816083419.41088-2-zhengqi.arch@bytedance.com> X-Rspamd-Queue-Id: F21234001E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 4njhum5k1gsppwyfnqc57u5bsqtw8xg3 X-HE-Tag: 1692191736-366080 X-HE-Meta: U2FsdGVkX194frYdG2P2Cy8NWlbcaGySZhZxvH1eqv2ZQcKEO9G2docv84ZVBGUelWbnVKVOSF90+BRCYX0eKBcTHWc4zrCrMGDCNBRvOFicdVnNkTm6EGx4hxG9zjF2HzkQYkmLgB4xwqbsp8VV3uPSWIuScVXMVnda9z7UOJcGlpeveK/0upbMHdGjIma1lr0NysS3ajLsBBNorppRuohjTdHxWlQl1DcC+Dtq5bBiEMiYUoBoEIs5VZPxDb/WTduhqPEE7N7xUFZf+h4mffkwKkJonl81s6EqBNb0KzbT+7jD8wnPYIpAQZz3J/AwUB7Ww7+liGMhwPkM+S0txXIBMgApmcUBoY/7S2vRja+4mMoinBBq0w21WvVvvJSo9C3CDc1lcwY6WVO+9e0JfddkyKzQoVbQArZ+pGgGWBnFjt6H9uPuoSPx69rd3FdP2q1h2pVg48tQBt7xo4gBp5Os7JskUj3sJKsJtp9h2VdLAFZ2fxnHDZpK2wduMfUZ+xjDfr/hQ96kVANtg89w7cwdJhMcPfy3jqLEXOPzOc+Ltdjm7g1xO9rSEqR/53//Ckk21ojYx7az4VyWMmAWBFALhgTWZ3wGpA7eaFdLNtEZH4ByakzBO7i8+mMNa3Q1OiiW11QfgpQQW4G/4wRalSGw7zB8C9+InMPKmxzN+ws36lcOSCmdGhVZAMGgPWIjkXK4coo0S/agtVGLJqi/5XLDxOvN1Cva98JWSDsCPpkfaHnWEkJuGFbao80Fm4e46tV9GdDdDqYEGnaV5phCBk4yQ9ls52pS3RlfoMGgHFHlXNpdpEgg5fDPXTFWmgox8dhNz0aCjku1NyFojQ33vZmD4Yixq2m8Zku5a2J2A+JyO7lw3AEgvXerfPDp9k/22hEi5yOAGqLNUe3qdh8MAqkEVcQTjsQfptg17PypKbhiYZJg/zlxMtboDBOs9maMjltAwHfSnSNh6R+Z2dV RzFGwQfC M7CJYEqJv3Z5LekToFJ8vagWg8PY5OYuhSIR1u0jM3pzkYtm3QRerogeiDK7swM67I5WF+jsuGA9NklqrJIBcGWCUHSAlpEy5TSkKGU/oxumnXmaEQ8+FQIZhZBV6BTTzNUXFzAqwTeR90ehu6Hhkp5QtHDqKqX3JIxIqGmdznWbSrQI0+Uku2vqwLiI4jcBCZd+IjTCln2fQ7qE2ykkbk4gpr5q5zKGMoN7giU7Wl22Xx+7TkSr3B7I8eerHwgsvM+HJCQm5VT5u7wdoNmHl8Q1u8V/UkopDk8Tt2p2cYVCPkTCf0YQU0fyq1cEBXD7Wdrrsu1RSKmgKB285AV+FBR+HyHDV1OeRQqPcUMWtE/S2PJoZOv6pPmg+KzPpBBItEapvl7TUVa18qb0mJGiE3ArFtGFQKzFHvilvPtS4F21lpM4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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@intel.com/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@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 | Closes: https://lore.kernel.org/oe-kbuild-all/202308162118.motJd6aG-lkp@intel.com/ 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