Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp853933rwb; Fri, 23 Sep 2022 05:11:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4bg6aDYLEiWoCT4so9ZxM8Zq/xdO3tvESu5ZW8Ammpkszgo49EmqAF92NsbJDl5yBMt3rQ X-Received: by 2002:a17:906:ee8e:b0:730:3646:d178 with SMTP id wt14-20020a170906ee8e00b007303646d178mr6967383ejb.426.1663935089714; Fri, 23 Sep 2022 05:11:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663935089; cv=none; d=google.com; s=arc-20160816; b=Ansxz4gmjNmIYpW7v1zn3GcLy7xwbQFSD8/MawAr4BwHomQ0DqKLeQA0MqaRKdoD4D VZpEjWfWijEFnyJ9/X5Z8DBKfLmIyoiSOFp0jYJzgJouIyOi+3VJsxuUZIWRUwCy1cwc ceHmWFsBYZZn2BInTSJzWXakxTQFS4jcwc6Q9ZarYJWH/52uo0jQMSY4GeWyneG/dNBG BVcOS0s8SWbvoLEqhSTLeV+Wg8+ZaqI8ZaVRcyVkJL9MkJAHOVIHufeB/OuPtPlG2kiX i/ElQMcp0j6fvBUc6O3Hr4278QOvxz3ctWEuWzpo5K25saPS4qBR8z4Ao4oGnRVsBRbh IPfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=xTc3zJOK2zfnZqbyJHoyAjTqNg0tpPsOo+Rmc5VBvTY=; b=z9fad0X/2pIL3lEV8kUgHEFajw7CyXgZyD0hQ5udHqlkd3rNCiaXb7YK3LNeqHFIdN h+8V+ApA8YXQyynVGTi9DKnD0ue8Av02txf+d4DvWgruvIYwmcmrmF+YbEfjXGyFEl+c 8FACwbY/kqFu0gkD8KRyI7swyPDXyQpQT0YmqL0c2ca1N3SnDHn1b4PUGywb/ffF0WZr 8D7Z3jMcWAbujdzePRi+1agpNeNQoKaOab2xKRRy4VCbmgk/ETbYRd8KKvEx1CmXbJce wcSADVxrY1eznDen/GxOJpKPWL2PXYD1fwYP3gb3HAWVP2DCdYCNVxVN3mzIYYa5rNm5 iwXQ== 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=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr13-20020a170907720d00b007815b8c72c1si8943383ejc.423.2022.09.23.05.11.04; Fri, 23 Sep 2022 05:11:29 -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=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231848AbiIWLtE (ORCPT + 99 others); Fri, 23 Sep 2022 07:49:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229928AbiIWLtC (ORCPT ); Fri, 23 Sep 2022 07:49:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C0746135070 for ; Fri, 23 Sep 2022 04:49:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 42E63139F; Fri, 23 Sep 2022 04:49:06 -0700 (PDT) Received: from [10.163.33.180] (unknown [10.163.33.180]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E49143F73D; Fri, 23 Sep 2022 04:48:57 -0700 (PDT) Message-ID: <92e976b8-5d51-8125-d14a-ba27da6cc285@arm.com> Date: Fri, 23 Sep 2022 17:18:54 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH] arm64: mm: handle ARM64_KERNEL_USES_PMD_MAPS in vmemmap_populate() Content-Language: en-US To: Kefeng Wang , Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org References: <20220920014951.196191-1-wangkefeng.wang@huawei.com> From: Anshuman Khandual In-Reply-To: <20220920014951.196191-1-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE 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 On 9/20/22 07:19, Kefeng Wang wrote: > 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 Reviewed-by: Anshuman Khandual > --- > 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,