linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
@ 2025-04-24 16:48 Andy Shevchenko
  2025-04-24 17:15 ` Vlastimil Babka
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-04-24 16:48 UTC (permalink / raw)
  To: Vlastimil Babka, linux-mm, linux-kernel, llvm
  Cc: Christoph Lameter, David Rientjes, Andrew Morton, Roman Gushchin,
	Harry Yoo, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Andy Shevchenko

need_slab_obj_ext() is used only in one place, fold it into there.
Without that, clang can't build kernel with `make W=1` when
CONFIG_WERROR=y, which is default in the x86 configurations.

mm/slub.c:2079:20: error: unused function 'need_slab_obj_ext' [-Werror,-Wunused-function]

To solve this, fold need_slab_obj_ext() into its only user.

Fixes: e33b7ae3d802 ("mm, slab: clean up slab->obj_exts always")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 mm/slub.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 966785362a62..50e9730828a6 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2048,18 +2048,6 @@ static inline void free_slab_obj_exts(struct slab *slab)
 	slab->obj_exts = 0;
 }
 
-static inline bool need_slab_obj_ext(void)
-{
-	if (mem_alloc_profiling_enabled())
-		return true;
-
-	/*
-	 * CONFIG_MEMCG creates vector of obj_cgroup objects conditionally
-	 * inside memcg_slab_post_alloc_hook. No other users for now.
-	 */
-	return false;
-}
-
 #else /* CONFIG_SLAB_OBJ_EXT */
 
 static inline void init_slab_obj_exts(struct slab *slab)
@@ -2076,11 +2064,6 @@ static inline void free_slab_obj_exts(struct slab *slab)
 {
 }
 
-static inline bool need_slab_obj_ext(void)
-{
-	return false;
-}
-
 #endif /* CONFIG_SLAB_OBJ_EXT */
 
 #ifdef CONFIG_MEM_ALLOC_PROFILING
@@ -2128,7 +2111,11 @@ __alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)
 static inline void
 alloc_tagging_slab_alloc_hook(struct kmem_cache *s, void *object, gfp_t flags)
 {
-	if (need_slab_obj_ext())
+	/*
+	 * CONFIG_MEMCG creates vector of obj_cgroup objects conditionally
+	 * inside memcg_slab_post_alloc_hook(). No other users for now.
+	 */
+	if (mem_alloc_profiling_enabled())
 		__alloc_tagging_slab_alloc_hook(s, object, flags);
 }
 
-- 
2.47.2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
  2025-04-24 16:48 [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user Andy Shevchenko
@ 2025-04-24 17:15 ` Vlastimil Babka
  2025-04-24 17:22   ` Andy Shevchenko
  2025-04-24 19:41 ` kernel test robot
  2025-04-24 20:35 ` kernel test robot
  2 siblings, 1 reply; 6+ messages in thread
From: Vlastimil Babka @ 2025-04-24 17:15 UTC (permalink / raw)
  To: Andy Shevchenko, linux-mm, linux-kernel, llvm
  Cc: Christoph Lameter, David Rientjes, Andrew Morton, Roman Gushchin,
	Harry Yoo, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Zhenhua Huang

On 4/24/25 18:48, Andy Shevchenko wrote:
> need_slab_obj_ext() is used only in one place, fold it into there.
> Without that, clang can't build kernel with `make W=1` when
> CONFIG_WERROR=y, which is default in the x86 configurations.

Note that gcc doesn't warn on this even with W=1.

Is really clang + W=1 + CONFIG_WERROR building ok these days except this one
unused function?

> mm/slub.c:2079:20: error: unused function 'need_slab_obj_ext' [-Werror,-Wunused-function]
> 
> To solve this, fold need_slab_obj_ext() into its only user.
> 
> Fixes: e33b7ae3d802 ("mm, slab: clean up slab->obj_exts always")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, I've folded the fix in.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
  2025-04-24 17:15 ` Vlastimil Babka
@ 2025-04-24 17:22   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-04-24 17:22 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: linux-mm, linux-kernel, llvm, Christoph Lameter, David Rientjes,
	Andrew Morton, Roman Gushchin, Harry Yoo, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, Zhenhua Huang

On Thu, Apr 24, 2025 at 07:15:00PM +0200, Vlastimil Babka wrote:
> On 4/24/25 18:48, Andy Shevchenko wrote:
> > need_slab_obj_ext() is used only in one place, fold it into there.
> > Without that, clang can't build kernel with `make W=1` when
> > CONFIG_WERROR=y, which is default in the x86 configurations.
> 
> Note that gcc doesn't warn on this even with W=1.
> 
> Is really clang + W=1 + CONFIG_WERROR building ok these days except this one
> unused function?

Almost, I'm working towards having it clean on x86 defconfigs that are in the
Linux kernel. There are only few left to address. GCC, FWIW, complains on bunch
of other things :-)

> > mm/slub.c:2079:20: error: unused function 'need_slab_obj_ext' [-Werror,-Wunused-function]
> > 
> > To solve this, fold need_slab_obj_ext() into its only user.
> > 
> > Fixes: e33b7ae3d802 ("mm, slab: clean up slab->obj_exts always")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Thanks, I've folded the fix in.

Thank you!

-- 
With Best Regards,
Andy Shevchenko




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
  2025-04-24 16:48 [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user Andy Shevchenko
  2025-04-24 17:15 ` Vlastimil Babka
@ 2025-04-24 19:41 ` kernel test robot
  2025-04-25 17:07   ` Andy Shevchenko
  2025-04-24 20:35 ` kernel test robot
  2 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2025-04-24 19:41 UTC (permalink / raw)
  To: Andy Shevchenko, Vlastimil Babka, linux-mm, linux-kernel, llvm
  Cc: llvm, oe-kbuild-all, Christoph Lameter, David Rientjes,
	Andrew Morton, Linux Memory Management List, Roman Gushchin,
	Harry Yoo, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt, Andy Shevchenko

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/mm-slab-fold-need_slab_obj_ext-into-its-only-user/20250425-004842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20250424164800.2658961-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
config: arm-randconfig-003-20250425 (https://download.01.org/0day-ci/archive/20250425/202504250357.9ZZudhto-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250425/202504250357.9ZZudhto-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/202504250357.9ZZudhto-lkp@intel.com/

All errors (new ones prefixed by >>):

>> mm/slub.c:2591:29: error: call to undeclared function 'need_slab_obj_ext'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    2591 |         if (memcg_kmem_online() || need_slab_obj_ext())
         |                                    ^
   mm/slub.c:2591:29: note: did you mean 'free_slab_obj_exts'?
   mm/slub.c:2064:20: note: 'free_slab_obj_exts' declared here
    2064 | static inline void free_slab_obj_exts(struct slab *slab)
         |                    ^
   1 error generated.


vim +/need_slab_obj_ext +2591 mm/slub.c

0bedcc66d2a43a Vlastimil Babka    2023-10-03  2587  
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2588  static __always_inline void unaccount_slab(struct slab *slab, int order,
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2589  					   struct kmem_cache *s)
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2590  {
4b8736964640fe Suren Baghdasaryan 2024-03-21 @2591  	if (memcg_kmem_online() || need_slab_obj_ext())
21c690a349baab Suren Baghdasaryan 2024-03-21  2592  		free_slab_obj_exts(slab);
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2593  
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2594  	mod_node_page_state(slab_pgdat(slab), cache_vmstat_idx(s),
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2595  			    -(PAGE_SIZE << order));
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2596  }
0bedcc66d2a43a Vlastimil Babka    2023-10-03  2597  

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
  2025-04-24 16:48 [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user Andy Shevchenko
  2025-04-24 17:15 ` Vlastimil Babka
  2025-04-24 19:41 ` kernel test robot
@ 2025-04-24 20:35 ` kernel test robot
  2 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2025-04-24 20:35 UTC (permalink / raw)
  To: Andy Shevchenko, Vlastimil Babka, linux-mm, linux-kernel, llvm
  Cc: oe-kbuild-all, Christoph Lameter, David Rientjes, Andrew Morton,
	Linux Memory Management List, Roman Gushchin, Harry Yoo,
	Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Andy Shevchenko

Hi Andy,

kernel test robot noticed the following build errors:

[auto build test ERROR on akpm-mm/mm-everything]

url:    https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/mm-slab-fold-need_slab_obj_ext-into-its-only-user/20250425-004842
base:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link:    https://lore.kernel.org/r/20250424164800.2658961-1-andriy.shevchenko%40linux.intel.com
patch subject: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
config: i386-buildonly-randconfig-001-20250425 (https://download.01.org/0day-ci/archive/20250425/202504250400.BLLCAX1T-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250425/202504250400.BLLCAX1T-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/202504250400.BLLCAX1T-lkp@intel.com/

All errors (new ones prefixed by >>):

   mm/slub.c: In function 'unaccount_slab':
>> mm/slub.c:2591:36: error: implicit declaration of function 'need_slab_obj_ext'; did you mean 'free_slab_obj_exts'? [-Werror=implicit-function-declaration]
    2591 |         if (memcg_kmem_online() || need_slab_obj_ext())
         |                                    ^~~~~~~~~~~~~~~~~
         |                                    free_slab_obj_exts
   cc1: some warnings being treated as errors


vim +2591 mm/slub.c

0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2587  
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2588  static __always_inline void unaccount_slab(struct slab *slab, int order,
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2589  					   struct kmem_cache *s)
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2590  {
4b8736964640fe1 Suren Baghdasaryan 2024-03-21 @2591  	if (memcg_kmem_online() || need_slab_obj_ext())
21c690a349baab8 Suren Baghdasaryan 2024-03-21  2592  		free_slab_obj_exts(slab);
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2593  
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2594  	mod_node_page_state(slab_pgdat(slab), cache_vmstat_idx(s),
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2595  			    -(PAGE_SIZE << order));
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2596  }
0bedcc66d2a43a5 Vlastimil Babka    2023-10-03  2597  

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user
  2025-04-24 19:41 ` kernel test robot
@ 2025-04-25 17:07   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2025-04-25 17:07 UTC (permalink / raw)
  To: kernel test robot
  Cc: Vlastimil Babka, linux-mm, linux-kernel, llvm, oe-kbuild-all,
	Christoph Lameter, David Rientjes, Andrew Morton, Roman Gushchin,
	Harry Yoo, Nathan Chancellor, Nick Desaulniers, Bill Wendling,
	Justin Stitt

On Fri, Apr 25, 2025 at 03:41:15AM +0800, kernel test robot wrote:
> Hi Andy,
> 
> kernel test robot noticed the following build errors:
> 
> [auto build test ERROR on akpm-mm/mm-everything]

Yes, it's fixup to the Linux Next commit which is not in Andrew's tree AFAIU.

-- 
With Best Regards,
Andy Shevchenko




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-25 17:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-24 16:48 [PATCH v1 1/1] mm, slab: fold need_slab_obj_ext() into its only user Andy Shevchenko
2025-04-24 17:15 ` Vlastimil Babka
2025-04-24 17:22   ` Andy Shevchenko
2025-04-24 19:41 ` kernel test robot
2025-04-25 17:07   ` Andy Shevchenko
2025-04-24 20:35 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox