The patch titled Subject: memcg: use res_counter_uncharge_until() in mem_cgroup_move_hugetlb_parent() has been removed from the -mm tree. Its filename was memcg-use-res_counter_uncharge_until-in-mem_cgroup_move_hugetlb_parent.patch This patch was dropped because an updated version will be merged The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Subject: memcg: use res_counter_uncharge_until() in mem_cgroup_move_hugetlb_parent() By using res_counter_uncharge_until(), we can avoid race and unnecessary charging. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx> Cc: Ying Han <yinghan@xxxxxxxxxx> Cc: Glauber Costa <glommer@xxxxxxxxxxxxx> Reviewed-by: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff -puN mm/memcontrol.c~memcg-use-res_counter_uncharge_until-in-mem_cgroup_move_hugetlb_parent mm/memcontrol.c --- a/mm/memcontrol.c~memcg-use-res_counter_uncharge_until-in-mem_cgroup_move_hugetlb_parent +++ a/mm/memcontrol.c @@ -3298,6 +3298,7 @@ int mem_cgroup_move_hugetlb_parent(int i struct cgroup *pcgrp = cgroup->parent; struct mem_cgroup *parent = mem_cgroup_from_cont(pcgrp); struct mem_cgroup *memcg = mem_cgroup_from_cont(cgroup); + struct res_counter *counter; if (!get_page_unless_zero(page)) goto out; @@ -3308,28 +3309,18 @@ int mem_cgroup_move_hugetlb_parent(int i goto err_out; csize = PAGE_SIZE << compound_order(page); - /* - * If we have use_hierarchy set we can never fail here. So instead of - * using res_counter_uncharge use the open-coded variant which just - * uncharge the child res_counter. The parent will retain the charge. - */ - if (parent->use_hierarchy) { - unsigned long flags; - struct res_counter *counter; - - counter = &memcg->hugepage[idx]; - spin_lock_irqsave(&counter->lock, flags); - res_counter_uncharge_locked(counter, csize); - spin_unlock_irqrestore(&counter->lock, flags); - } else { + /* If parent->use_hierarchy == 0, we need to charge parent */ + if (!parent->use_hierarchy) { ret = res_counter_charge(&parent->hugepage[idx], csize, &fail_res); if (ret) { ret = -EBUSY; goto err_out; } - res_counter_uncharge(&memcg->hugepage[idx], csize); } + counter = &memcg->hugepage[idx]; + res_counter_uncharge_until(counter, counter->parent, csize); + pc->mem_cgroup = parent; err_out: unlock_page_cgroup(pc); _ Patches currently in -mm which might be from kamezawa.hiroyu@xxxxxxxxxxxxxx are linux-next.patch memcg-rename-mem_cgroup_stat_swapout-as-mem_cgroup_stat_swap.patch memcg-rename-mem_cgroup_charge_type_mapped-as-mem_cgroup_charge_type_anon.patch memcg-remove-mem_cgroup_charge_type_force.patch memcg-move-charges-to-root-cgroup-if-use_hierarchy=0-in-mem_cgroup_move_hugetlb_parent.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html