Since commit 7ae88534cdd9 ("mm: move mem_cgroup_uncharge out of __page_cache_release()"), the mem_cgroup will be uncharged when hpage is freed. Uncharge mem_cgroup here is harmless but it looks confusing and buggy: if mem_cgroup charge failed, we will call mem_cgroup_uncharge() uncorrectly in error path because hpage is not IS_ERR_OR_NULL(). Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> --- mm/khugepaged.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index e886a8618c33..68579cdbdc9b 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1211,8 +1211,6 @@ static void collapse_huge_page(struct mm_struct *mm, out_up_write: mmap_write_unlock(mm); out_nolock: - if (!IS_ERR_OR_NULL(*hpage)) - mem_cgroup_uncharge(*hpage); trace_mm_collapse_huge_page(mm, isolated, result); return; out: @@ -1968,8 +1966,6 @@ static void collapse_file(struct mm_struct *mm, unlock_page(new_page); out: VM_BUG_ON(!list_empty(&pagelist)); - if (!IS_ERR_OR_NULL(*hpage)) - mem_cgroup_uncharge(*hpage); /* TODO: tracepoints */ } -- 2.19.1