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 730DAC43460 for ; Wed, 21 Apr 2021 06:51:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0DADA61426 for ; Wed, 21 Apr 2021 06:51:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DADA61426 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 9E8C06B0072; Wed, 21 Apr 2021 02:51:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9C0D86B0073; Wed, 21 Apr 2021 02:51:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 839E56B0074; Wed, 21 Apr 2021 02:51:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 67A276B0072 for ; Wed, 21 Apr 2021 02:51:34 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2484B180CA833 for ; Wed, 21 Apr 2021 06:51:34 +0000 (UTC) X-FDA: 78055453308.07.6E755C5 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf07.hostedemail.com (Postfix) with ESMTP id 79219A00038D for ; Wed, 21 Apr 2021 06:51:33 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 63128613ED; Wed, 21 Apr 2021 06:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618987892; bh=15Yty9Stc/s7dDkOEgwIyIbN8ST3TSGYU3qMkcXC9hU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TmrcFIb08lfBH7VLeugKq4BbEtT6ScBiCAusHWFXcACDAT9opqtVqCujIpyrOKLH6 HmEMAvcHI/0+ziMxSNgj7LAnWtjlra9aVXMDDZgbt6gxW73TntknR63NiRjV7E+YPB 2FeVpn/9oGhfE6uGETTV12ae5sk0dIXAc3hWUamjsew5hccK6HCjX+/V/S5rHE+EXj gu3G/Ez8OOl4UFKHMqPV15Ycke5deiFTulaN4l2hXOXl4s74Tb6aIeYzh7NkgShF60 aeG8U7oUpz5xSpmhsQdZlkFEHobmPMmkiunZI+xgWK5kpoKT9dnC5/TmjhQz1LYQzK nVWz+T/5RCEFA== From: Mike Rapoport To: linux-arm-kernel@lists.infradead.org Cc: Andrew Morton , 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 v2 4/4] arm64: drop pfn_valid_within() and simplify pfn_valid() Date: Wed, 21 Apr 2021 09:51:08 +0300 Message-Id: <20210421065108.1987-5-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210421065108.1987-1-rppt@kernel.org> References: <20210421065108.1987-1-rppt@kernel.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 79219A00038D X-Stat-Signature: efqfp86jd1ax64rnmrtw3g6jo86jzpir Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf07; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618987893-10231 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 dc03bdc12c0f..eb3f56fb8c7c 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