From patchwork Mon Mar 14 15:32:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12780329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6374EC433EF for ; Mon, 14 Mar 2022 15:33:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E9DC96B0073; Mon, 14 Mar 2022 11:33:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4C348D0002; Mon, 14 Mar 2022 11:33:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D14BD8D0001; Mon, 14 Mar 2022 11:33:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id C31306B0073 for ; Mon, 14 Mar 2022 11:33:20 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 987E921E7F for ; Mon, 14 Mar 2022 15:33:20 +0000 (UTC) X-FDA: 79243385760.10.4B8C8C2 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf02.hostedemail.com (Postfix) with ESMTP id 837528001F for ; Mon, 14 Mar 2022 15:33:19 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KHL9H5rwFzBrwW; Mon, 14 Mar 2022 23:31:15 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 14 Mar 2022 23:33:15 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH] mm/mlock: remove unneeded start >= vma->vm_end check Date: Mon, 14 Mar 2022 23:32:23 +0800 Message-ID: <20220314153223.53753-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 837528001F X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf02.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: uhe8gx756h1nzydjqpd1tshd18m5mhpn X-Rspamd-Server: rspam04 X-HE-Tag: 1647271999-963645 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: If find_vma returns a vma, it must satisfies that start < vma->vm_end. Since vma list is sorted in the ascending order, so we will never see start >= vma->vm_end here. Remove this unneeded check. Signed-off-by: Miaohe Lin --- mm/mlock.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index fefa9644d0f9..fe278634ebe3 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -509,8 +509,6 @@ static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm, return 0; for (; vma ; vma = vma->vm_next) { - if (start >= vma->vm_end) - continue; if (start + len <= vma->vm_start) break; if (vma->vm_flags & VM_LOCKED) {