From patchwork Thu Feb 4 11:29:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12067119 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=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 EE842C433E6 for ; Thu, 4 Feb 2021 11:30:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6222364F46 for ; Thu, 4 Feb 2021 11:30:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6222364F46 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 B96F36B006E; Thu, 4 Feb 2021 06:30:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B46A16B0070; Thu, 4 Feb 2021 06:30:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A831C6B0071; Thu, 4 Feb 2021 06:30:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0172.hostedemail.com [216.40.44.172]) by kanga.kvack.org (Postfix) with ESMTP id 8E3D16B006E for ; Thu, 4 Feb 2021 06:30:18 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4FE6C1EE6 for ; Thu, 4 Feb 2021 11:30:18 +0000 (UTC) X-FDA: 77780366916.09.order61_530a749275db Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id 36C60180AD80F for ; Thu, 4 Feb 2021 11:30:18 +0000 (UTC) X-HE-Tag: order61_530a749275db X-Filterd-Recvd-Size: 1785 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 11:30:17 +0000 (UTC) Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DWbsx3h30zjHsJ; Thu, 4 Feb 2021 19:29:09 +0800 (CST) Received: from huawei.com (10.175.104.175) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.498.0; Thu, 4 Feb 2021 19:30:04 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH] mm/hugetlb: use helper function range_in_vma() in page_table_shareable() Date: Thu, 4 Feb 2021 06:29:49 -0500 Message-ID: <20210204112949.43051-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Originating-IP: [10.175.104.175] 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: We could use helper function range_in_vma() to check whether the vma is in the desired range to simplify the code. Signed-off-by: Miaohe Lin Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cf82629319ed..442705be052a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5237,7 +5237,7 @@ static unsigned long page_table_shareable(struct vm_area_struct *svma, */ if (pmd_index(addr) != pmd_index(saddr) || vm_flags != svm_flags || - sbase < svma->vm_start || svma->vm_end < s_end) + !range_in_vma(svma, sbase, s_end)) return 0; return saddr;