Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3314290rwb; Mon, 19 Sep 2022 19:35:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5jHCKd0l51BuSuUtKW+lg7zfrvYp2nCT7tvi3XZs54YfAOobFf7cRgnQY95AbOysPV0Gc0 X-Received: by 2002:a05:6402:5489:b0:43b:b935:db37 with SMTP id fg9-20020a056402548900b0043bb935db37mr18776496edb.347.1663641310723; Mon, 19 Sep 2022 19:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663641310; cv=none; d=google.com; s=arc-20160816; b=xAhVeOEfJVO25M6w/UNf3aTDG6btIDKUQqOZHf1Pl983pVBwkBMDTxcWwM0GwzwBZS xvJG8Ium27VDeSI1AG5Omsb0kdczcIVCbM6Lsgw6KxgIjcxgEtEmz3EtGUNedyPy+pei xsVjaIeE8NRajubm/BMtP2fhz2p7BDoCKcFCMTop3YnXTsBHgKg//OUeN37xWm6FQodl BAJiUnkWvDQGjF/WAz/LlxGTFKlpadbEGDb+pzycm6mFgMLUeaD8/H1xGtOwl7GEZpkc EjOd/RU4eZkcy8wkP50Ard8hQfV2WM3leuQ9MO9OJ9URS2fpazjgXLbLVJe9XzdTRWij FIag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fM1PoKJ4XCgjxoQb8hbQPM3cIg/bVGn+41+1EPI4bnc=; b=RnleWsOihqqEXHWg/VwE/MK7Nzk6PnTJHSsoZCspxLohyVT8Oy41/UvLa9tGmm5xoq vOWoULMheMNIqvGozFQc+IKwoDk2dka+8UDt9y7+upv0bGAfPNj1++ilLWaMB1RJyDvM K8Fi/qW7k8N/eVqQLAZ48Tf9q02oRreNbzuLB5WsKZZyd+giu8AFmox5xxtHeXeJNaMr JmiAHR8UNk3gbY7ZEp5+jXaSaag/lvWYrCtfTuq6JwEzXsXbjM1B+j96L/cHf7uOk8Hs NTs8+xN1fAhFTqI1EMazpKF0nYFauB99SnAsKHl0nRiqTIEgPxrS+EpILmHDJzMOyr7O FrTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a1709063a8b00b00780f607444asi23633ejd.868.2022.09.19.19.34.45; Mon, 19 Sep 2022 19:35:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbiITBqf (ORCPT + 99 others); Mon, 19 Sep 2022 21:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230046AbiITBq3 (ORCPT ); Mon, 19 Sep 2022 21:46:29 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEB13558EF for ; Mon, 19 Sep 2022 18:46:25 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MWkqM2vGQzHnhm; Tue, 20 Sep 2022 09:44:15 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 20 Sep 2022 09:46:23 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 20 Sep 2022 09:46:23 +0800 From: Kefeng Wang To: Catalin Marinas , Will Deacon , CC: , Kefeng Wang Subject: [PATCH] arm64: mm: handle ARM64_KERNEL_USES_PMD_MAPS in vmemmap_populate() Date: Tue, 20 Sep 2022 09:49:51 +0800 Message-ID: <20220920014951.196191-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Directly check ARM64_SWAPPER_USES_SECTION_MAPS to choose base page or PMD level huge page mapping in vmemmap_populate() to simplify code a bit. Signed-off-by: Kefeng Wang --- arch/arm64/mm/mmu.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 5810eddfb48e..784afa9c60ac 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -1180,14 +1180,6 @@ static void free_empty_tables(unsigned long addr, unsigned long end, } #endif -#if !ARM64_KERNEL_USES_PMD_MAPS -int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, - struct vmem_altmap *altmap) -{ - WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END)); - return vmemmap_populate_basepages(start, end, node, altmap); -} -#else /* !ARM64_KERNEL_USES_PMD_MAPS */ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, struct vmem_altmap *altmap) { @@ -1199,6 +1191,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, pmd_t *pmdp; WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END)); + + if (!ARM64_KERNEL_USES_PMD_MAPS) + return vmemmap_populate_basepages(start, end, node, altmap); + do { next = pmd_addr_end(addr, end); @@ -1232,7 +1228,6 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, return 0; } -#endif /* !ARM64_KERNEL_USES_PMD_MAPS */ #ifdef CONFIG_MEMORY_HOTPLUG void vmemmap_free(unsigned long start, unsigned long end, -- 2.35.3