@@ -76,8 +76,7 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware,
__list_lru_init((lru), true, NULL, shrinker)
int memcg_update_all_list_lrus(int num_memcgs);
-void memcg_drain_all_list_lrus(struct mem_cgroup *src_memcg,
- struct mem_cgroup *dst_memcg);
+void memcg_reparent_list_lrus(struct mem_cgroup *memcg, struct mem_cgroup *parent);
/**
* list_lru_add: add an element to the lru list's tail
@@ -440,8 +440,8 @@ int memcg_update_all_list_lrus(int new_size)
return ret;
}
-static void memcg_drain_list_lru_node(struct list_lru *lru, int nid,
- int src_idx, struct mem_cgroup *dst_memcg)
+static void memcg_reparent_list_lru_node(struct list_lru *lru, int nid,
+ int src_idx, struct mem_cgroup *dst_memcg)
{
struct list_lru_node *nlru = &lru->node[nid];
int dst_idx = dst_memcg->kmemcg_id;
@@ -491,22 +491,21 @@ static void list_lru_per_memcg_free(struct list_lru *lru, int src_idx)
kvfree_rcu(mlru, rcu);
}
-static void memcg_drain_list_lru(struct list_lru *lru,
- int src_idx, struct mem_cgroup *dst_memcg)
+static void memcg_reparent_list_lru(struct list_lru *lru,
+ int src_idx, struct mem_cgroup *dst_memcg)
{
int i;
for_each_node(i)
- memcg_drain_list_lru_node(lru, i, src_idx, dst_memcg);
+ memcg_reparent_list_lru_node(lru, i, src_idx, dst_memcg);
list_lru_per_memcg_free(lru, src_idx);
}
-void memcg_drain_all_list_lrus(struct mem_cgroup *src_memcg,
- struct mem_cgroup *dst_memcg)
+void memcg_reparent_list_lrus(struct mem_cgroup *memcg, struct mem_cgroup *parent)
{
struct list_lru *lru;
- int src_idx = src_memcg->kmemcg_id;
+ int src_idx = memcg->kmemcg_id;
/*
* Change kmemcg_id of this cgroup to the parent's id, and then move
@@ -519,11 +518,11 @@ void memcg_drain_all_list_lrus(struct mem_cgroup *src_memcg,
* from allocating list lrus for this cgroup after calling
* list_lru_per_memcg_free().
*/
- src_memcg->kmemcg_id = dst_memcg->kmemcg_id;
+ memcg->kmemcg_id = parent->kmemcg_id;
mutex_lock(&list_lrus_mutex);
list_for_each_entry(lru, &list_lrus, list)
- memcg_drain_list_lru(lru, src_idx, dst_memcg);
+ memcg_reparent_list_lru(lru, src_idx, parent);
mutex_unlock(&list_lrus_mutex);
}
@@ -3485,14 +3485,14 @@ static void memcg_offline_kmem(struct mem_cgroup *memcg)
memcg_reparent_objcgs(memcg, parent);
/*
- * memcg_drain_all_list_lrus() can change memcg->kmemcg_id.
+ * memcg_reparent_list_lrus() can change memcg->kmemcg_id.
* Cache it to @kmemcg_id.
*/
kmemcg_id = memcg->kmemcg_id;
BUG_ON(kmemcg_id < 0);
/* memcg_reparent_objcgs() must be called before this. */
- memcg_drain_all_list_lrus(memcg, parent);
+ memcg_reparent_list_lrus(memcg, parent);
memcg_free_cache_id(kmemcg_id);
}
The purpose of the memcg_drain_all_list_lrus() is list_lrus reparenting. It is very similar to memcg_reparent_objcgs(). Rename it to memcg_reparent_list_lrus() so that the name can more consistent with memcg_reparent_objcgs(). Signed-off-by: Muchun Song <songmuchun@bytedance.com> --- include/linux/list_lru.h | 3 +-- mm/list_lru.c | 19 +++++++++---------- mm/memcontrol.c | 4 ++-- 3 files changed, 12 insertions(+), 14 deletions(-)