On Wed, 26 Feb 2020, Michal Hocko wrote: > On Wed 26-02-20 18:44:13, Cristopher Lameter wrote: > > On Wed, 26 Feb 2020, Michal Hocko wrote: > > > > > Besides that kmalloc_node shouldn't really have an implicit GFP_THISNODE > > > semantic right? At least I do not see anything like that documented > > > anywhere. > > > > Kmalloc_node does not support memory policies etc. Only kmalloc does. > > kmalloc_node is mostly used by subsystems that have determined the active > > nodes and want a targeted allocation on those nodes. > > I am sorry but I have hard time to follow your responses here. They open > more questions than they answer for me. The primary point here is that > kmalloc_node on a memory less node blows up and panics the kernel. I > strongly believe this is a bug. We cannot really make all callers of > kmalloc_node and co. to be hotplug aware. > > Another question is the semantic of kmalloc_node when the node cannot > satisfy the request. I have always thought that the allocation would > simply fall back to any other node unless __GFP_THISNODE is explicitly > specified. > Am I right in classifying this as a trade-off between an unlikely(!node_state(nid, N_MEMORY)) directly in kmalloc_node() vs fixing up a caller passing a memoryless nid? Seems like we wouldn't want to penalize kmalloc_node() for making such a check for 99.99% of allocators that don't need it and would rather do a node_to_mem_node(nid) or numa_mem_id() in the caller?