diff mbox series

+hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patchadded to -mm tree

Message ID 20210318031148.B3PWbGSo4%akpm@linux-foundation.org
State Superseded
Headers show
Series +hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patchadded to -mm tree | expand

Commit Message

Andrew Morton March 18, 2021, 3:11 a.m. UTC
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@huawei.com>
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@huawei.com
Fixes: 075a61d07a8e ("hugetlb_cgroup: add accounting for shared mappings")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reported-by: kernel test robot <lkp@intel.com> (auto build test ERROR)
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Cc: Wanpeng Li <liwp.linux@gmail.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/hugetlb.c        |   13 ++++++-------
 mm/hugetlb_cgroup.c |    3 +--
 2 files changed, 7 insertions(+), 9 deletions(-)
diff mbox series

Patch

--- 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);