Commit 86daf94e authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Linus Torvalds
Browse files

mm/memcontrol.c: allocate shrinker_map on appropriate NUMA node

The shrinker_map may be touched from any cpu (e.g., a bit there may be set
by a task running everywhere) but kswapd is always bound to specific node.
So allocate shrinker_map from the related NUMA node to respect its NUMA
locality.  Also, this follows generic way we use for allocation of memcg's
per-node data.
Signed-off-by: default avatarKirill Tkhai <>
Signed-off-by: default avatarAndrew Morton <>
Reviewed-by: default avatarDavid Hildenbrand <>
Reviewed-by: default avatarShakeel Butt <>
Reviewed-by: default avatarRoman Gushchin <>
Acked-by: default avatarMichal Hocko <>
Cc: Johannes Weiner <>
Cc: Vladimir Davydov <>

Signed-off-by: default avatarLinus Torvalds <>
parent a87425a3
......@@ -334,7 +334,7 @@ static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg,
if (!old)
return 0;
new = kvmalloc(sizeof(*new) + size, GFP_KERNEL);
new = kvmalloc_node(sizeof(*new) + size, GFP_KERNEL, nid);
if (!new)
return -ENOMEM;
......@@ -378,7 +378,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg)
size = memcg_shrinker_map_size;
for_each_node(nid) {
map = kvzalloc(sizeof(*map) + size, GFP_KERNEL);
map = kvzalloc_node(sizeof(*map) + size, GFP_KERNEL, nid);
if (!map) {
ret = -ENOMEM;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment