Hi Liu, Thank you for the patch! Yet something to improve: [auto build test ERROR on vbabka-slab/for-next] [also build test ERROR on linus/master v6.1-rc2 next-20221024] [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/Liu-Shixin/Refactor-__kmem_cache_create-and-fix-memory-leak/20221024-145607 base: git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git for-next patch link: https://lore.kernel.org/r/20221024074232.151383-4-liushixin2%40huawei.com patch subject: [PATCH 3/4] mm/slab_common: Separate sysfs_slab_add() and debugfs_slab_add() from __kmem_cache_create() config: mips-buildonly-randconfig-r001-20221023 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 791a7ae1ba3efd6bca96338e10ffde557ba83920) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install mips cross compiling tool for clang build # apt-get install binutils-mipsel-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/b431907fc9bd145502e0bdb34fcb4b1b67770f2a git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Liu-Shixin/Refactor-__kmem_cache_create-and-fix-memory-leak/20221024-145607 git checkout b431907fc9bd145502e0bdb34fcb4b1b67770f2a # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot All errors (new ones prefixed by >>): >> mm/slab_common.c:239:9: error: call to undeclared function 'sysfs_slab_add'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] err = sysfs_slab_add(s); ^ >> mm/slab_common.c:244:3: error: call to undeclared function 'debugfs_slab_add'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] debugfs_slab_add(s); ^ 2 errors generated. vim +/sysfs_slab_add +239 mm/slab_common.c 204 205 static struct kmem_cache *create_cache(const char *name, 206 unsigned int object_size, unsigned int align, 207 slab_flags_t flags, unsigned int useroffset, 208 unsigned int usersize, void (*ctor)(void *), 209 struct kmem_cache *root_cache) 210 { 211 struct kmem_cache *s; 212 const char *cache_name; 213 int err = -ENOMEM; 214 215 if (WARN_ON(useroffset + usersize > object_size)) 216 useroffset = usersize = 0; 217 218 s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL); 219 if (!s) 220 return ERR_PTR(err); 221 222 cache_name = kstrdup_const(name, GFP_KERNEL); 223 if (!cache_name) 224 goto out_free_cache; 225 226 s->name = cache_name; 227 s->size = s->object_size = object_size; 228 s->align = align; 229 s->ctor = ctor; 230 s->useroffset = useroffset; 231 s->usersize = usersize; 232 233 err = __kmem_cache_create(s, flags); 234 if (err) 235 goto out_free_name; 236 237 /* Mutex is not taken during early boot */ 238 if (slab_state >= FULL) { > 239 err = sysfs_slab_add(s); 240 if (err) { 241 slab_kmem_cache_release(s); 242 return ERR_PTR(err); 243 } > 244 debugfs_slab_add(s); 245 } 246 247 s->refcount = 1; 248 list_add(&s->list, &slab_caches); 249 return s; 250 251 out_free_name: 252 kfree_const(s->name); 253 out_free_cache: 254 kmem_cache_free(kmem_cache, s); 255 return ERR_PTR(err); 256 } 257 -- 0-DAY CI Kernel Test Service https://01.org/lkp