From mboxrd@z Thu Jan 1 00:00:00 1970 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.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 BCCF2C433B4 for ; Tue, 20 Apr 2021 09:14:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 46B6D6135F for ; Tue, 20 Apr 2021 09:14:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46B6D6135F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D07036B0071; Tue, 20 Apr 2021 05:14:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDF0D6B0072; Tue, 20 Apr 2021 05:14:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCC086B0073; Tue, 20 Apr 2021 05:14:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id A09976B0071 for ; Tue, 20 Apr 2021 05:14:37 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 5E797181AEF09 for ; Tue, 20 Apr 2021 09:14:37 +0000 (UTC) X-FDA: 78052184994.19.D3F4E47 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP id 36D77E000122 for ; Tue, 20 Apr 2021 09:14:36 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 22648613B0; Tue, 20 Apr 2021 09:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618910076; bh=e0Fi9wjwVAjNSoqCvZhmS1czaKaDc65hVPR9ELVVAAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Euqs6IieJbshhUUBT6OyccubGx6rWYF7fAdoO7YS4gqcu25nHwH/s5T8jEXwbI1ew FT4bHjYLmhV4tQQfkw0bNn79NX9FLrmKNWW7YfXCBYX1tLaA6WDR0zK1zJMMOH/qcT lA0vOAiTkSutrf5UXcCESLOS/4t3Z+ZXMkH8JKoS8BtCMGxVL6bZtX4gLdxjgDB+6i TW5n3Gy0FCLwIo5On1LyxJb+NINkT7p/Jm1Dz7+FR9fLlRhK8mpn4xb0sFWpUeqI94 JIkR9HRM2fygHx3Pkap3+jPV/+vRj1JZpREeE/IUfYWisdwHP7nm9aHbMrMFDp09x+ N1MmqU9faxbow== From: Mike Rapoport To: linux-arm-kernel@lists.infradead.org Cc: Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Marc Zyngier , Mark Rutland , Mike Rapoport , Mike Rapoport , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 4/4] arm64: drop pfn_valid_within() and simplify pfn_valid() Date: Tue, 20 Apr 2021 12:09:25 +0300 Message-Id: <20210420090925.7457-5-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210420090925.7457-1-rppt@kernel.org> References: <20210420090925.7457-1-rppt@kernel.org> MIME-Version: 1.0 X-Stat-Signature: obs3gn7tuf97fq8rme58hatmetfm4a7t X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 36D77E000122 Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf05; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618910076-528873 Content-Transfer-Encoding: quoted-printable 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: From: Mike Rapoport The arm64's version of pfn_valid() differs from the generic because of tw= o reasons: * Parts of the memory map are freed during boot. This makes it necessary = to verify that there is actual physical memory that corresponds to a pfn which is done by querying memblock. * There are NOMAP memory regions. These regions are not mapped in the linear map and until the previous commit the struct pages representing these areas had default values. As the consequence of absence of the special treatment of NOMAP regions i= n the memory map it was necessary to use memblock_is_map_memory() in pfn_valid() and to have pfn_valid_within() aliased to pfn_valid() so that generic mm functionality would not treat a NOMAP page as a normal page. Since the NOMAP regions are now marked as PageReserved(), pfn walkers and the rest of core mm will treat them as unusable memory and thus pfn_valid_within() is no longer required at all and can be disabled by removing CONFIG_HOLES_IN_ZONE on arm64. pfn_valid() can be slightly simplified by replacing memblock_is_map_memory() with memblock_is_memory(). Signed-off-by: Mike Rapoport --- arch/arm64/Kconfig | 3 --- arch/arm64/mm/init.c | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index e4e1b6550115..58e439046d05 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -1040,9 +1040,6 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK def_bool y depends on NUMA =20 -config HOLES_IN_ZONE - def_bool y - source "kernel/Kconfig.hz" =20 config ARCH_SPARSEMEM_ENABLE diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index c54e329aca15..370f33765b64 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -243,7 +243,7 @@ int pfn_valid(unsigned long pfn) =20 /* * ZONE_DEVICE memory does not have the memblock entries. - * memblock_is_map_memory() check for ZONE_DEVICE based + * memblock_is_memory() check for ZONE_DEVICE based * addresses will always fail. Even the normal hotplugged * memory will never have MEMBLOCK_NOMAP flag set in their * memblock entries. Skip memblock search for all non early @@ -254,7 +254,7 @@ int pfn_valid(unsigned long pfn) return pfn_section_valid(ms, pfn); } #endif - return memblock_is_map_memory(addr); + return memblock_is_memory(addr); } EXPORT_SYMBOL(pfn_valid); =20 --=20 2.28.0