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.3 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,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 31F46C433E0 for ; Mon, 15 Mar 2021 01:50:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3CC9E64E64 for ; Mon, 15 Mar 2021 01:50:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3CC9E64E64 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 7C3AD6B0006; Sun, 14 Mar 2021 21:50:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74C306B006C; Sun, 14 Mar 2021 21:50:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C6D26B0070; Sun, 14 Mar 2021 21:50:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3C10F6B0006 for ; Sun, 14 Mar 2021 21:50:29 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EF7481730876 for ; Mon, 15 Mar 2021 01:50:28 +0000 (UTC) X-FDA: 77920428936.30.60D8D49 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf25.hostedemail.com (Postfix) with ESMTP id 9BD4B6000100 for ; Mon, 15 Mar 2021 01:50:27 +0000 (UTC) Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DzK7P1ypvzNmsd; Mon, 15 Mar 2021 09:48:01 +0800 (CST) Received: from [10.174.177.131] (10.174.177.131) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Mon, 15 Mar 2021 09:50:22 +0800 Subject: Re: [PATCH 5/5] mm/hugetlb: avoid calculating fault_mutex_hash in truncate_op case To: Mike Kravetz , CC: , References: <20210308112809.26107-1-linmiaohe@huawei.com> <20210308112809.26107-6-linmiaohe@huawei.com> <2baf9a1b-1c69-8168-cfd9-5b5ad45a4cc8@oracle.com> <9f385943-4038-f457-c742-30982b8b7d5d@oracle.com> From: Miaohe Lin Message-ID: Date: Mon, 15 Mar 2021 09:50:22 +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: <9f385943-4038-f457-c742-30982b8b7d5d@oracle.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.131] X-CFilter-Loop: Reflected X-Stat-Signature: 4za6nri6pos5r5irnjcyf5ejhnx87kkh X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9BD4B6000100 Received-SPF: none (huawei.com>: No applicable sender policy available) receiver=imf25; identity=mailfrom; envelope-from=""; helo=szxga05-in.huawei.com; client-ip=45.249.212.191 X-HE-DKIM-Result: none/none X-HE-Tag: 1615773027-428122 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: On 2021/3/14 5:17, Mike Kravetz wrote: > On 3/12/21 6:49 PM, Miaohe Lin wrote: >> Hi: >> On 2021/3/13 4:03, Mike Kravetz wrote: >>> On 3/8/21 3:28 AM, Miaohe Lin wrote: >>>> The fault_mutex hashing overhead can be avoided in truncate_op case because >>>> page faults can not race with truncation in this routine. So calculate hash >>>> for fault_mutex only in !truncate_op case to save some cpu cycles. >>>> >>>> Signed-off-by: Miaohe Lin >>>> --- >>>> fs/hugetlbfs/inode.c | 4 ++-- >>>> 1 file changed, 2 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c >>>> index c262566f7c5d..d81f52b87bd7 100644 >>>> --- a/fs/hugetlbfs/inode.c >>>> +++ b/fs/hugetlbfs/inode.c >>>> @@ -482,10 +482,9 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart, >>>> >>>> for (i = 0; i < pagevec_count(&pvec); ++i) { >>>> struct page *page = pvec.pages[i]; >>>> - u32 hash; >>>> + u32 hash = 0; >>> >>> Do we need to initialize hash here? >>> I would not bring this up normally, but the purpose of the patch is to save >>> cpu cycles. >> >> The hash is initialized here in order to avoid false positive >> "uninitialized local variable used" warning. Or this is indeed unnecessary? >> > > Of course. In this case we know more about usage then the compiler. > You can add: > I see. Many thanks. Am I supposed to resend the whole v2 patch series ? Or just a single v2 patch with change mentioned above? Please let me know which is the easiest one for you. > Reviewed-by: Mike Kravetz >