Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [akpm-mm:mm-new 107/142] mm/zsmalloc.c:800:21: warning: 'obj_to_class_idx' defined but not used
@ 2026-06-29 11:18 kernel test robot
  2026-06-29 16:47 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-06-29 11:18 UTC (permalink / raw)
  To: Wenchao Hao
  Cc: oe-kbuild-all, David Hildenbrand, Andrew Morton,
	Linux Memory Management List, mm-commits, Nhat Pham

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   88cefc306c43b58d9bb65c9e96e284306710d961
commit: b3a8a00229ce2b0367afff075a00d53b92e1234a [107/142] mm/zsmalloc: encode class index in obj value for lockless class lookup
config: csky-randconfig-001-20260629 (https://download.01.org/0day-ci/archive/20260629/202606291933.Cw5TBs54-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260629/202606291933.Cw5TBs54-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/202606291933.Cw5TBs54-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> mm/zsmalloc.c:800:21: warning: 'obj_to_class_idx' defined but not used [-Wunused-function]
     800 | static unsigned int obj_to_class_idx(unsigned long obj)
         |                     ^~~~~~~~~~~~~~~~


vim +/obj_to_class_idx +800 mm/zsmalloc.c

   798	
   799	/* Folds to 0 when ZS_OBJ_CLASS_BITS == 0; no ifdef needed at callers. */
 > 800	static unsigned int obj_to_class_idx(unsigned long obj)
   801	{
   802		return (obj >> ZS_OBJ_IDX_BITS) & ZS_OBJ_CLASS_MASK;
   803	}
   804	

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


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

* Re: [akpm-mm:mm-new 107/142] mm/zsmalloc.c:800:21: warning: 'obj_to_class_idx' defined but not used
  2026-06-29 11:18 [akpm-mm:mm-new 107/142] mm/zsmalloc.c:800:21: warning: 'obj_to_class_idx' defined but not used kernel test robot
@ 2026-06-29 16:47 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-06-29 16:47 UTC (permalink / raw)
  To: kernel test robot
  Cc: Wenchao Hao, oe-kbuild-all, David Hildenbrand,
	Linux Memory Management List, mm-commits, Nhat Pham

On Mon, 29 Jun 2026 19:18:51 +0800 kernel test robot <lkp@intel.com> wrote:

> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> head:   88cefc306c43b58d9bb65c9e96e284306710d961
> commit: b3a8a00229ce2b0367afff075a00d53b92e1234a [107/142] mm/zsmalloc: encode class index in obj value for lockless class lookup
> config: csky-randconfig-001-20260629 (https://download.01.org/0day-ci/archive/20260629/202606291933.Cw5TBs54-lkp@intel.com/config)
> compiler: csky-linux-gcc (GCC) 10.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260629/202606291933.Cw5TBs54-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/202606291933.Cw5TBs54-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
> >> mm/zsmalloc.c:800:21: warning: 'obj_to_class_idx' defined but not used [-Wunused-function]
>      800 | static unsigned int obj_to_class_idx(unsigned long obj)
>          |                     ^~~~~~~~~~~~~~~~

Thanks.  How does this look?

- fix obj_to_class_idx() defined but not used
- remove duplicated #ifdef CONFIG_COMPACTION

 mm/zsmalloc.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

--- a/mm/zsmalloc.c~mm-zsmalloc-encode-class-index-in-obj-value-for-lockless-class-lookup-fix
+++ a/mm/zsmalloc.c
@@ -796,12 +796,6 @@ static void obj_to_zpdesc(unsigned long
 	*zpdesc = pfn_zpdesc(obj >> ZS_OBJ_PFN_SHIFT);
 }
 
-/* Folds to 0 when ZS_OBJ_CLASS_BITS == 0; no ifdef needed at callers. */
-static unsigned int obj_to_class_idx(unsigned long obj)
-{
-	return (obj >> ZS_OBJ_IDX_BITS) & ZS_OBJ_CLASS_MASK;
-}
-
 /**
  * location_to_obj - encode (<zpdesc>, <obj_idx>, <class_idx>) into obj value
  * @zpdesc: zpdesc object resides in zspage
@@ -1719,9 +1713,12 @@ static void lock_zspage(struct zspage *z
 	}
 	zspage_read_unlock(zspage);
 }
-#endif /* CONFIG_COMPACTION */
 
-#ifdef CONFIG_COMPACTION
+/* Folds to 0 when ZS_OBJ_CLASS_BITS == 0; no ifdef needed at callers. */
+static unsigned int obj_to_class_idx(unsigned long obj)
+{
+	return (obj >> ZS_OBJ_IDX_BITS) & ZS_OBJ_CLASS_MASK;
+}
 
 static void replace_sub_page(struct size_class *class, struct zspage *zspage,
 				struct zpdesc *newzpdesc, struct zpdesc *oldzpdesc)
_



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

end of thread, other threads:[~2026-06-29 16:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 11:18 [akpm-mm:mm-new 107/142] mm/zsmalloc.c:800:21: warning: 'obj_to_class_idx' defined but not used kernel test robot
2026-06-29 16:47 ` Andrew Morton

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