From patchwork Thu Mar 18 03:11:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 404710 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9F60C433E6 for ; Thu, 18 Mar 2021 03:12:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 630A364F21 for ; Thu, 18 Mar 2021 03:12:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229702AbhCRDMJ (ORCPT ); Wed, 17 Mar 2021 23:12:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:47308 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230226AbhCRDMB (ORCPT ); Wed, 17 Mar 2021 23:12:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A93764EED; Thu, 18 Mar 2021 03:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1616037109; bh=2pzQy79hR4wFUXzO4EX8JiZmJ6WObZ7/dhz1YgeYCWc=; h=Date:From:To:Subject:From; b=rxo3Lekc4yGjGfDLaqp9q8bBZc5tQw5FfoV2GcMQc1qjuI+qurhBwihL/A6byMp6/ W38nnUYeRKZztNerwPdXNL1b6mgWyRK501dLHKqelGPQqn6qP/4ZW4bnFNfppks4Sz 4J2IEV2iaIorKMN5SIVCtxksS4PLELSTyzlsJClk= Date: Wed, 17 Mar 2021 20:11:48 -0700 From: akpm@linux-foundation.org To: almasrymina@google.com, aneesh.kumar@linux.vnet.ibm.com, linmiaohe@huawei.com, liwp.linux@gmail.com, lkp@intel.com, mike.kravetz@oracle.com, mm-commits@vger.kernel.org, stable@vger.kernel.org Subject: + hugetlb_cgroup-fix-imbalanced-css_get-and-css_put-pair-for-shared-mappings-v3.patch added to -mm tree Message-ID: <20210318031148.B3PWbGSo4%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 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 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 Reported-by: kernel test robot (auto build test ERROR) Reviewed-by: Mike Kravetz Cc: Aneesh Kumar K.V Cc: Wanpeng Li Cc: Mina Almasry Cc: Signed-off-by: Andrew Morton --- 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);