Skip to contentSkip to conversation

slab.h-kmalloc_node

KJ Vignesh Babu BM 2 participants 2 messages Apr 7, 2007 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Can some one please explain the significance of 'int node' in the below functions?...as they are clearly not being used in the statements inside the function.

#ifndef CONFIG_NUMA
static inline void *kmalloc_node(size_t size, gfp_t flags, int node)

{
	return kmalloc(size, flags);
}

static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)

{
	return __kmalloc(size, flags);
}

#endif /* !CONFIG_NUMA */

Signature · 8 lines
Regards,  
Vignesh Babu BM  
_____________________________________________________________  
"Why is it that every time I'm with you, makes me believe in magic?"
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#1 lore raw
Quoted 10 lines · Vignesh Babu BM

Can some one please explain the significance of 'int node' in the below functions?...as they are clearly not being used in the statements inside the function.

#ifndef CONFIG_NUMA
static inline void *kmalloc_node(size_t size, gfp_t flags, int node)

{
	return kmalloc(size, flags);
}
Quoted 5 lines

static inline void *__kmalloc_node(size_t size, gfp_t flags, int node)

{
	return __kmalloc(size, flags);
}

#endif /* !CONFIG_NUMA */

These functions are only compiled for non-NUMA systems, as such I would wager a guess that the NUMA versions does use the node, and from what I understand of NUMA a node would refer to the memory node on which the callee would prefer to have the memory allocated.

These functions are thus probably provided simply for convenience, to allow NUMA optimized code to still compile on non-NUMA systems.

Jaco
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors