linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [akpm-mm:mm-new 59/87] mm/slub.c:6168:23: error: invalid use of undefined type 'struct node_notify'
@ 2025-06-20 13:20 kernel test robot
  2025-06-22 18:59 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-06-20 13:20 UTC (permalink / raw)
  To: Oscar Salvador
  Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List,
	Jonathan Cameron, Harry Yoo, Vlastimil Babka

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
head:   647b5532fd070b0a20f01c5bad726fac7f490a53
commit: d0b0b62aa0d6d93098331467596c34b252bfad11 [59/87] mm,slub: use node-notifier instead of memory-notifier
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20250620/202506202144.dGkFxasv-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250620/202506202144.dGkFxasv-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/202506202144.dGkFxasv-lkp@intel.com/

All errors (new ones prefixed by >>):

   mm/slub.c: In function 'slab_mem_going_online_callback':
>> mm/slub.c:6168:23: error: invalid use of undefined type 'struct node_notify'
    6168 |         int nid = narg->nid;
         |                       ^~
   mm/slub.c: In function 'slab_memory_callback':
>> mm/slub.c:6220:14: error: 'NODE_ADDING_FIRST_MEMORY' undeclared (first use in this function)
    6220 |         case NODE_ADDING_FIRST_MEMORY:
         |              ^~~~~~~~~~~~~~~~~~~~~~~~
   mm/slub.c:6220:14: note: each undeclared identifier is reported only once for each function it appears in
>> mm/slub.c:6223:14: error: 'NODE_REMOVING_LAST_MEMORY' undeclared (first use in this function)
    6223 |         case NODE_REMOVING_LAST_MEMORY:
         |              ^~~~~~~~~~~~~~~~~~~~~~~~~
   mm/slub.c: In function 'kmem_cache_init':
>> mm/slub.c:6300:9: error: implicit declaration of function 'hotplug_node_notifier'; did you mean 'hotplug_memory_notifier'? [-Wimplicit-function-declaration]
    6300 |         hotplug_node_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
         |         ^~~~~~~~~~~~~~~~~~~~~
         |         hotplug_memory_notifier


vim +6168 mm/slub.c

  6162	
  6163	static int slab_mem_going_online_callback(void *arg)
  6164	{
  6165		struct kmem_cache_node *n;
  6166		struct kmem_cache *s;
  6167		struct node_notify *narg = arg;
> 6168		int nid = narg->nid;
  6169		int ret = 0;
  6170	
  6171		/*
  6172		 * If the node's memory is already available, then kmem_cache_node is
  6173		 * already created. Nothing to do.
  6174		 */
  6175		if (nid < 0)
  6176			return 0;
  6177	
  6178		/*
  6179		 * We are bringing a node online. No memory is available yet. We must
  6180		 * allocate a kmem_cache_node structure in order to bring the node
  6181		 * online.
  6182		 */
  6183		mutex_lock(&slab_mutex);
  6184		list_for_each_entry(s, &slab_caches, list) {
  6185			/*
  6186			 * The structure may already exist if the node was previously
  6187			 * onlined and offlined.
  6188			 */
  6189			if (get_node(s, nid))
  6190				continue;
  6191			/*
  6192			 * XXX: kmem_cache_alloc_node will fallback to other nodes
  6193			 *      since memory is not yet available from the node that
  6194			 *      is brought up.
  6195			 */
  6196			n = kmem_cache_alloc(kmem_cache_node, GFP_KERNEL);
  6197			if (!n) {
  6198				ret = -ENOMEM;
  6199				goto out;
  6200			}
  6201			init_kmem_cache_node(n);
  6202			s->node[nid] = n;
  6203		}
  6204		/*
  6205		 * Any cache created after this point will also have kmem_cache_node
  6206		 * initialized for the new node.
  6207		 */
  6208		node_set(nid, slab_nodes);
  6209	out:
  6210		mutex_unlock(&slab_mutex);
  6211		return ret;
  6212	}
  6213	
  6214	static int slab_memory_callback(struct notifier_block *self,
  6215					unsigned long action, void *arg)
  6216	{
  6217		int ret = 0;
  6218	
  6219		switch (action) {
> 6220		case NODE_ADDING_FIRST_MEMORY:
  6221			ret = slab_mem_going_online_callback(arg);
  6222			break;
> 6223		case NODE_REMOVING_LAST_MEMORY:
  6224			ret = slab_mem_going_offline_callback(arg);
  6225			break;
  6226		}
  6227		if (ret)
  6228			ret = notifier_from_errno(ret);
  6229		else
  6230			ret = NOTIFY_OK;
  6231		return ret;
  6232	}
  6233	
  6234	/********************************************************************
  6235	 *			Basic setup of slabs
  6236	 *******************************************************************/
  6237	
  6238	/*
  6239	 * Used for early kmem_cache structures that were allocated using
  6240	 * the page allocator. Allocate them properly then fix up the pointers
  6241	 * that may be pointing to the wrong kmem_cache structure.
  6242	 */
  6243	
  6244	static struct kmem_cache * __init bootstrap(struct kmem_cache *static_cache)
  6245	{
  6246		int node;
  6247		struct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT);
  6248		struct kmem_cache_node *n;
  6249	
  6250		memcpy(s, static_cache, kmem_cache->object_size);
  6251	
  6252		/*
  6253		 * This runs very early, and only the boot processor is supposed to be
  6254		 * up.  Even if it weren't true, IRQs are not up so we couldn't fire
  6255		 * IPIs around.
  6256		 */
  6257		__flush_cpu_slab(s, smp_processor_id());
  6258		for_each_kmem_cache_node(s, node, n) {
  6259			struct slab *p;
  6260	
  6261			list_for_each_entry(p, &n->partial, slab_list)
  6262				p->slab_cache = s;
  6263	
  6264	#ifdef CONFIG_SLUB_DEBUG
  6265			list_for_each_entry(p, &n->full, slab_list)
  6266				p->slab_cache = s;
  6267	#endif
  6268		}
  6269		list_add(&s->list, &slab_caches);
  6270		return s;
  6271	}
  6272	
  6273	void __init kmem_cache_init(void)
  6274	{
  6275		static __initdata struct kmem_cache boot_kmem_cache,
  6276			boot_kmem_cache_node;
  6277		int node;
  6278	
  6279		if (debug_guardpage_minorder())
  6280			slub_max_order = 0;
  6281	
  6282		/* Print slub debugging pointers without hashing */
  6283		if (__slub_debug_enabled())
  6284			no_hash_pointers_enable(NULL);
  6285	
  6286		kmem_cache_node = &boot_kmem_cache_node;
  6287		kmem_cache = &boot_kmem_cache;
  6288	
  6289		/*
  6290		 * Initialize the nodemask for which we will allocate per node
  6291		 * structures. Here we don't need taking slab_mutex yet.
  6292		 */
  6293		for_each_node_state(node, N_MEMORY)
  6294			node_set(node, slab_nodes);
  6295	
  6296		create_boot_cache(kmem_cache_node, "kmem_cache_node",
  6297				sizeof(struct kmem_cache_node),
  6298				SLAB_HWCACHE_ALIGN | SLAB_NO_OBJ_EXT, 0, 0);
  6299	
> 6300		hotplug_node_notifier(slab_memory_callback, SLAB_CALLBACK_PRI);
  6301	
  6302		/* Able to allocate the per node structures */
  6303		slab_state = PARTIAL;
  6304	
  6305		create_boot_cache(kmem_cache, "kmem_cache",
  6306				offsetof(struct kmem_cache, node) +
  6307					nr_node_ids * sizeof(struct kmem_cache_node *),
  6308				SLAB_HWCACHE_ALIGN | SLAB_NO_OBJ_EXT, 0, 0);
  6309	
  6310		kmem_cache = bootstrap(&boot_kmem_cache);
  6311		kmem_cache_node = bootstrap(&boot_kmem_cache_node);
  6312	
  6313		/* Now we can use the kmem_cache to allocate kmalloc slabs */
  6314		setup_kmalloc_cache_index_table();
  6315		create_kmalloc_caches();
  6316	
  6317		/* Setup random freelists for each cache */
  6318		init_freelist_randomization();
  6319	
  6320		cpuhp_setup_state_nocalls(CPUHP_SLUB_DEAD, "slub:dead", NULL,
  6321					  slub_cpu_dead);
  6322	
  6323		pr_info("SLUB: HWalign=%d, Order=%u-%u, MinObjects=%u, CPUs=%u, Nodes=%u\n",
  6324			cache_line_size(),
  6325			slub_min_order, slub_max_order, slub_min_objects,
  6326			nr_cpu_ids, nr_node_ids);
  6327	}
  6328	

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


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

end of thread, other threads:[~2025-06-22 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-20 13:20 [akpm-mm:mm-new 59/87] mm/slub.c:6168:23: error: invalid use of undefined type 'struct node_notify' kernel test robot
2025-06-22 18:59 ` Andrew Morton

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