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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 51FCCC433DB for ; Thu, 18 Feb 2021 02:27:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05CE364E42 for ; Thu, 18 Feb 2021 02:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbhBRC1z (ORCPT ); Wed, 17 Feb 2021 21:27:55 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:12551 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbhBRC1v (ORCPT ); Wed, 17 Feb 2021 21:27:51 -0500 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Dgz7t493bzMZP5; Thu, 18 Feb 2021 10:25:14 +0800 (CST) Received: from [10.174.179.144] (10.174.179.144) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.498.0; Thu, 18 Feb 2021 10:27:06 +0800 Subject: Re: [PATCH] mm/hugetlb: remove redundant reservation check condition in alloc_huge_page() To: Mike Kravetz CC: , , Andrew Morton References: <20210210075443.26238-1-linmiaohe@huawei.com> <32f628d5-fa0c-2a81-2de4-d0a76d1c3e45@oracle.com> From: Miaohe Lin Message-ID: <9cd0da77-65c3-5ba2-f882-b54a1950bf39@huawei.com> Date: Thu, 18 Feb 2021 10:27:07 +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: <32f628d5-fa0c-2a81-2de4-d0a76d1c3e45@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.144] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi: On 2021/2/13 9:15, Mike Kravetz wrote: > On 2/9/21 11:54 PM, Miaohe Lin wrote: >> If there is no reservation corresponding to a vma, map_chg is always != 0, >> i.e. we can not meet the condition where a vma does not have reservation >> while map_chg = 0. > > This commit message might be easier to understand? > > vma_resv_map(vma) checks if a reserve map is associated with the vma. The > routine vma_needs_reservation() will check vma_resv_map(vma) and return 1 > if no reserv map is present. map_chg is set to the return value of > vma_needs_reservation(). Therefore, !vma_resv_map(vma) is redundant in the > expression: > map_chg || avoid_reserve || !vma_resv_map(vma); > Remove the redundant check. > Sorry for late respond! I will use this wonderful commit message. Many thanks! :)