[Devel] [PATCH RHEL7 COMMIT] ms/mm: Allocate shrinker_map on appropriate NUMA node

Konstantin Khorenko khorenko at virtuozzo.com
Thu Feb 27 15:24:12 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1062.12.1.vz7.131.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.12.1.vz7.131.4
------>
commit bb7cce9fa82d517daaa2f9e7e3faea0f99a8da73
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Feb 27 15:24:12 2020 +0300

    ms/mm: Allocate shrinker_map on appropriate NUMA node
    
    Despite shrinker_map may be touched from any cpu
    (e.g., a bit there may be set by a task running
    everywhere); kswapd is always bound to specific
    node. So, we will allocate shrinker_map from
    related NUMA node to respect its NUMA locality.
    Also, this follows generic way we use for allocation
    memcg's per-node data.
    
    This goes to ms: https://patchwork.kernel.org/patch/11360241/
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 mm/memcontrol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index b0727105f5369..7d6f1b2c8b41b 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -748,7 +748,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;
 
@@ -793,7 +793,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg)
 	mutex_lock(&memcg_shrinker_map_mutex);
 	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) {
 			memcg_free_shrinker_maps(memcg);
 			ret = -ENOMEM;


More information about the Devel mailing list