From mboxrd@z Thu Jan 1 00:00:00 1970 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.4 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 3676AC433E0 for ; Fri, 5 Feb 2021 03:08:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7815A64EE2 for ; Fri, 5 Feb 2021 03:08:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7815A64EE2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C09C16B006C; Thu, 4 Feb 2021 22:08:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BBAB26B006E; Thu, 4 Feb 2021 22:08:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD0EA6B0070; Thu, 4 Feb 2021 22:08:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id 98FA06B006C for ; Thu, 4 Feb 2021 22:08:19 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 6B8413626 for ; Fri, 5 Feb 2021 03:08:19 +0000 (UTC) X-FDA: 77782730718.01.dock07_16052f9275e1 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin01.hostedemail.com (Postfix) with ESMTP id 51685100462FF for ; Fri, 5 Feb 2021 03:08:19 +0000 (UTC) X-HE-Tag: dock07_16052f9275e1 X-Filterd-Recvd-Size: 3416 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 03:08:18 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DX0hG1fmVzjJ2D; Fri, 5 Feb 2021 11:07:10 +0800 (CST) Received: from [10.174.179.241] (10.174.179.241) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Fri, 5 Feb 2021 11:08:13 +0800 Subject: Re: [PATCH] mm/hugetlb: Remove obsolete comment in vma_has_reserves() To: Mike Kravetz CC: , , Andrew Morton References: <20210204111500.24111-1-linmiaohe@huawei.com> <8f2f3bac-5b33-a560-9b84-b50972739636@oracle.com> From: Miaohe Lin Message-ID: <43b7a6e0-1940-ebe8-4005-d6d8021653c3@huawei.com> Date: Fri, 5 Feb 2021 11:08:12 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <8f2f3bac-5b33-a560-9b84-b50972739636@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.241] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi: On 2021/2/5 5:32, Mike Kravetz wrote: > On 2/4/21 3:15 AM, Miaohe Lin wrote: >> Shared mappings are allowed to be created without reservations since >> commit c37f9fb11c97 ("hugetlb: allow huge page mappings to be created >> without reservations"). Remove this obsolete comment which may cause >> confusing. >> >> Signed-off-by: Miaohe Lin >> --- >> mm/hugetlb.c | 1 - >> 1 file changed, 1 deletion(-) >> >> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >> index 9501ec6ad517..cf82629319ed 100644 >> --- a/mm/hugetlb.c >> +++ b/mm/hugetlb.c >> @@ -998,7 +998,6 @@ static bool vma_has_reserves(struct vm_area_struct *vma, long chg) >> return false; >> } >> >> - /* Shared mappings always use reserves */ > > I would not say the comment is entirely obsolete or does not apply here. > > As mentioned in the commit message, commit c37f9fb11c97 allowed hugetlb > mappings to be created without reserves. It does this by supporting the > MAP_NORESERVE flag which corresponds to the VM_NORESERVE vma flag. > > Right before this comment, a check is made for VM_NORESERVE and the > routine will return. Therefore, by the time we get to this comment > we know MAP_NORESERVE does not apply and there are reserves associated > the shared mapping. In this case the comment is making a distinction > between shared mappings which will always have reserves, and private > mappings which may or may not have reserves depending on ownership. > Yes. If I think about it this way, the comment is really making a distinction between shared mappings and private mappings when not in VM_NORESERVE case. > I would suggest either leaving the comment as is, or modifying to include I'd like to leave the comment as is. Many thanks for detailed explanation. > the information above. To me, the three distinct blocks of code handling > the NORESERVE, shared and private cases makes things fairly clear and > the comment does apply in that context. > Many thanks again. :)