On Wed 26-02-20 12:31:56, David Rientjes wrote: > 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? The thing is that any check for node online/populated followed by the allocation is inherently racy without using memory hotplug locking around that and I am pretty sure this is a step into a wrong direction. Is there any problem to initialize slub internal data structures for all possible nodes? This wouldn't require any checks into hot paths. -- Michal Hocko SUSE Labs