mm/slub.c:1946:34: error: unused function 'memcg_from_slab_obj'

From: kernel test robot
Date: Sat Jan 13 2024 - 07:35:52 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 052d534373b7ed33712a63d5e17b2b6cdbce84fd
commit: 0bedcc66d2a43a50ab660273842f4737a293dd8a mm/slab: move memcg related functions from slab.h to slub.c
date: 5 weeks ago
config: x86_64-sof-customedconfig-edison-defconfig (https://download.01.org/0day-ci/archive/20240113/202401132054.I2L6evrk-lkp@xxxxxxxxx/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240113/202401132054.I2L6evrk-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/202401132054.I2L6evrk-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> mm/slub.c:1946:34: error: unused function 'memcg_from_slab_obj' [-Werror,-Wunused-function]
1946 | static inline struct mem_cgroup *memcg_from_slab_obj(void *ptr)
| ^~~~~~~~~~~~~~~~~~~
1 error generated.


vim +/memcg_from_slab_obj +1946 mm/slub.c

1915
1916 static inline void memcg_slab_free_hook(struct kmem_cache *s, struct slab *slab,
1917 void **p, int objects)
1918 {
1919 struct obj_cgroup **objcgs;
1920 int i;
1921
1922 if (!memcg_kmem_online())
1923 return;
1924
1925 objcgs = slab_objcgs(slab);
1926 if (!objcgs)
1927 return;
1928
1929 for (i = 0; i < objects; i++) {
1930 struct obj_cgroup *objcg;
1931 unsigned int off;
1932
1933 off = obj_to_index(s, slab, p[i]);
1934 objcg = objcgs[off];
1935 if (!objcg)
1936 continue;
1937
1938 objcgs[off] = NULL;
1939 obj_cgroup_uncharge(objcg, obj_full_size(s));
1940 mod_objcg_state(objcg, slab_pgdat(slab), cache_vmstat_idx(s),
1941 -obj_full_size(s));
1942 obj_cgroup_put(objcg);
1943 }
1944 }
1945 #else /* CONFIG_MEMCG_KMEM */
> 1946 static inline struct mem_cgroup *memcg_from_slab_obj(void *ptr)
1947 {
1948 return NULL;
1949 }
1950

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