The patch titled Subject: hugetlb_cgroup: fix imbalanced css_get and css_put pair for shared mappings has been added to the -mm tree. Its filename is hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Miaohe Lin <linmiaohe@xxxxxxxxxx> Subject: hugetlb_cgroup: fix imbalanced css_get and css_put pair for shared mappings reshape some comments, per Mike Link: https://lkml.kernel.org/r/20210316023002.53921-1-linmiaohe@xxxxxxxxxx Fixes: 075a61d07a8e ("hugetlb_cgroup: add accounting for shared mappings") Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx> Reported-by: kernel test robot <lkp@xxxxxxxxx> (auto build test ERROR) Reviewed-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx> Cc: Wanpeng Li <liwp.linux@xxxxxxxxx> Cc: Mina Almasry <almasrymina@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 13 ++++++------- mm/hugetlb_cgroup.c | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) --- a/mm/hugetlb.c~hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3 +++ a/mm/hugetlb.c @@ -281,13 +281,12 @@ static void record_hugetlb_cgroup_unchar &h_cg->rsvd_hugepage[hstate_index(h)]; nrg->css = &h_cg->css; /* - * The caller (hugetlb_reserve_pages now) will only hold one - * h_cg->css reference for the whole contiguous reservation - * region. But this area might be scattered when there are - * already some file_regions reside in it. As a result, many - * file_regions may share only one h_cg->css reference. In - * order to ensure that one file_region must hold and only - * hold one h_cg->css reference, we should do css_get for + * The caller will hold exactly one h_cg->css reference for the + * whole contiguous reservation region. But this area might be + * scattered when there are already some file_regions reside in + * it. As a result, many file_regions may share only one css + * reference. In order to ensure that one file_region must hold + * exactly one h_cg->css reference, we should do css_get for * each file_region and leave the reference held by caller * untouched. */ --- a/mm/hugetlb_cgroup.c~hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3 +++ a/mm/hugetlb_cgroup.c @@ -403,8 +403,7 @@ void hugetlb_cgroup_uncharge_file_region nr_pages * resv->pages_per_hpage); /* * Only do css_put(rg->css) when we delete the entire region - * because one file_region must hold and only hold one rg->css - * reference. + * because one file_region must hold exactly one css reference. */ if (region_del) css_put(rg->css); _ Patches currently in -mm which might be from linmiaohe@xxxxxxxxxx are hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings.patch hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patch mm-hugetlb-remove-redundant-reservation-check-condition-in-alloc_huge_page.patch mm-hugetlb-use-some-helper-functions-to-cleanup-code.patch mm-hugetlb-optimize-the-surplus-state-transfer-code-in-move_hugetlb_state.patch hugetlb_cgroup-remove-unnecessary-vm_bug_on_page-in-hugetlb_cgroup_migrate.patch mm-hugetlb-simplify-the-code-when-alloc_huge_page-failed-in-hugetlb_no_page.patch mm-hugetlb-avoid-calculating-fault_mutex_hash-in-truncate_op-case.patch khugepaged-remove-unneeded-return-value-of-khugepaged_collapse_pte_mapped_thps.patch khugepaged-reuse-the-smp_wmb-inside-__setpageuptodate.patch khugepaged-use-helper-khugepaged_test_exit-in-__khugepaged_enter.patch khugepaged-fix-wrong-result-value-for-trace_mm_collapse_huge_page_isolate.patch mm-huge_memoryc-remove-unnecessary-local-variable-ret2.patch