From patchwork Mon Jul 4 13:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12905366 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 184DFC433EF for ; Mon, 4 Jul 2022 13:22:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81BF96B0088; Mon, 4 Jul 2022 09:22:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77F886B0087; Mon, 4 Jul 2022 09:22:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F6866B0088; Mon, 4 Jul 2022 09:22:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3E1A46B0087 for ; Mon, 4 Jul 2022 09:22:21 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D3DBC20F1D for ; Mon, 4 Jul 2022 13:22:20 +0000 (UTC) X-FDA: 79649481240.04.E43A200 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf24.hostedemail.com (Postfix) with ESMTP id 5D5D8180013 for ; Mon, 4 Jul 2022 13:22:20 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Lc5xy2Fq4zhZ1C; Mon, 4 Jul 2022 21:19:50 +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.2375.24; Mon, 4 Jul 2022 21:22:13 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v3 07/16] mm/huge_memory: use helper function vma_lookup in split_huge_pages_pid Date: Mon, 4 Jul 2022 21:21:52 +0800 Message-ID: <20220704132201.14611-8-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220704132201.14611-1-linmiaohe@huawei.com> References: <20220704132201.14611-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656940940; a=rsa-sha256; cv=none; b=bD6akUAB1EULzO3FY7LuD98zChOMC3nXq6hnY2sU+vByx6pY8uJkoeDZEZgWBO7Q3vRN+Z 62IueNYafIjtitBZWzqeWHLZC6PVrQ8IdLMnXwFDK428JPW44ju1yy0x03u4+ABTlLgFF3 5abmkMIqsKfFhg9ccwU7o+ac8a7gh88= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656940940; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nXSyN1XUraXiislyjCiSCevwm5EI71BgJwuSPTFirQA=; b=6+b5SQSTxRuTiFLvTEt+PQylLuPE2/N/3jfIPOcAIQEN51/W7m0OP2wzmvosvNsHnju29I cn5MyBDZflreRcvEt+vpz2vg+6ZAAQ9lKWQM6fb7JtDDdZqTEMnMOhGQDOz6M58DS2OeiQ shtUZ2LcF1pNFG3PCQ/XDsQpdNZ/rqU= Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf24.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 5D5D8180013 X-Rspam-User: X-Stat-Signature: gm1rr7sggm3pch4updbs9ps4yzpr8ptd X-HE-Tag: 1656940940-377820 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: Use helper function vma_lookup to lookup the needed vma to simplify the code. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: Muchun Song --- mm/huge_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f2856cfac900..5f5123130b28 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3045,10 +3045,10 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start, * table filled with PTE-mapped THPs, each of which is distinct. */ for (addr = vaddr_start; addr < vaddr_end; addr += PAGE_SIZE) { - struct vm_area_struct *vma = find_vma(mm, addr); + struct vm_area_struct *vma = vma_lookup(mm, addr); struct page *page; - if (!vma || addr < vma->vm_start) + if (!vma) break; /* skip special VMA and hugetlb VMA */