On Mon 31-01-22 14:19:01, Andrew Morton wrote: > From: Wei Yang <richard.weiyang@xxxxxxxxx> > Subject: memcg: do not tweak node in alloc_mem_cgroup_per_node_info > > alloc_mem_cgroup_per_node_info is allocated for each possible node and > this used to be a problem because not !node_online nodes didn't have Wei has pointed to my typo here. s@not !node_online@!online@ > appropriate data structure allocated. This has changed by "mm: handle > uninitialized numa nodes gracefully" so we can drop the special casing > here. > > Link: https://lkml.kernel.org/r/20220127085305.20890-7-mhocko@xxxxxxxxxx > Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> > Signed-off-by: Michal Hocko <mhocko@xxxxxxxx> > Cc: David Hildenbrand <david@xxxxxxxxxx> > Cc: Alexey Makhalov <amakhalov@xxxxxxxxxx> > Cc: Dennis Zhou <dennis@xxxxxxxxxx> > Cc: Eric Dumazet <eric.dumazet@xxxxxxxxx> > Cc: Tejun Heo <tj@xxxxxxxxxx> > Cc: Christoph Lameter <cl@xxxxxxxxx> > Cc: Nico Pache <npache@xxxxxxxxxx> > Cc: Wei Yang <richard.weiyang@xxxxxxxxx> > Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx> > Cc: Oscar Salvador <osalvador@xxxxxxx> > Cc: Rafael Aquini <raquini@xxxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > --- > > mm/memcontrol.c | 14 ++------------ > 1 file changed, 2 insertions(+), 12 deletions(-) > > --- a/mm/memcontrol.c~memcg-do-not-tweak-node-in-alloc_mem_cgroup_per_node_info > +++ a/mm/memcontrol.c > @@ -5067,18 +5067,8 @@ struct mem_cgroup *mem_cgroup_from_id(un > static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) > { > struct mem_cgroup_per_node *pn; > - int tmp = node; > - /* > - * This routine is called against possible nodes. > - * But it's BUG to call kmalloc() against offline node. > - * > - * TODO: this routine can waste much memory for nodes which will > - * never be onlined. It's better to use memory hotplug callback > - * function. > - */ > - if (!node_state(node, N_NORMAL_MEMORY)) > - tmp = -1; > - pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, tmp); > + > + pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, node); > if (!pn) > return 1; > > _ > > Patches currently in -mm which might be from richard.weiyang@xxxxxxxxx are > > mm-page_alloc-add-same-penalty-is-enough-to-get-round-robin-order.patch > mm-page_alloc-add-penalty-to-local_node.patch > memcg-do-not-tweak-node-in-alloc_mem_cgroup_per_node_info.patch -- Michal Hocko SUSE Labs