Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3374907pxj; Tue, 11 May 2021 03:06:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/CqM8yh36pWNZZhLuaoedFvgzrimUx56MZ1uR2B2IVfFCj9h5Oqx0axKqonimjaptXQLb X-Received: by 2002:a5d:9a8c:: with SMTP id c12mr21783692iom.166.1620727609206; Tue, 11 May 2021 03:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620727609; cv=none; d=google.com; s=arc-20160816; b=gOZpfGImjAnwNfXGRXi54HyxjSgESJ2g6jrFheFh6JZ8ND6NoHHFNnm0Udbj0SEudT fGWUW8U6JVvpKcIQP8GWypqhM3cKmvhFFosVPhEIzlfcf4Kc6bC72fne9a0nQVfWGT36 9TzTGCtgEmwrQBhurvoihyRaF6+lmDe0kSRzbWZ08Jsmpnma1eak/p81p7wutEB1tpnU 9bTWxn9fOf+GfBmgnZYPQ8OaJ27nnSPr3SrnbxY4/PYeoghxYOsg1uoNjt6JptDqzDCF cs9a4mFHf6bo1SvR/P5e9OKarjhBLfufvD5VqEcE05eaXsGAuNcnEVBrvRnfDR4/0zJb BltA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nsMjETRv5KDBczCUG4e+4l/GxynCE1J+Dz7wWczoB30=; b=GjeioVbGhyDn722UfHtimhhe9NB59g19IM7/7zaPMAFAOXA5QEs4PZTtEXHugL0FNr EVJBvST+gBtwNiqNYlbu0VqExz0vNOU2MdIPb3BZYv+1YGMGyQZ8lnmpdQCQn2cuujrh yHUCU157rX5mG2COfC6t5XekfL6Vr7Cl/LKNiC0BgGeZFIu7GUjiI/T9DtcGJ7gAyHvy Gmp9wKrSqLmaAelBmeKUMVMLQbCWJ9JMSfY/ZzbNf9HxTFpSoTlV3DeR3kVai0RU96EY AZfU7MgW1kzG+LeuTbyEs8UF5DuhpeMV3DtJPRQj1D2LrrATKKB0B6XLMR1KuvPUYm3x oaeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DyQ3OZvS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si19503275ilm.87.2021.05.11.03.06.37; Tue, 11 May 2021 03:06:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DyQ3OZvS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231317AbhEKKHJ (ORCPT + 99 others); Tue, 11 May 2021 06:07:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:41884 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230146AbhEKKHJ (ORCPT ); Tue, 11 May 2021 06:07:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6326C61925; Tue, 11 May 2021 10:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620727563; bh=LE00JXn6JpyvcSFw6kRi1i0Orit+XbdWVHE/yEogFnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DyQ3OZvSpvBGY8GWhx+paJ4GHTInjnncZyvBdLrzCeKw+tVJD/bre4JHwued/V+XH TrQwMGnvKv4QIh1VTrIT2Tui+R1GRR1oW0XGi5NylsraCRFzTSID4lWjqzWgaUKmIb pgnutv8LqAga8qZgOwP5UgZPNwT4TkuUMdV2/vsZNoX9x7qzae9FZVULOHeSq4MVJh Md+dGyBByx6uf+FfwitOYmGNcjWr//k6PF79Wkn3PglNUW0td2CnHm3N4gnEy0o3DY 0zLd/vZ+ezusbAInkkIU3sYTQSvObfmfWj+9N9MzhUVstJoyabmNpnl+dPMXOOD43M oYcU4Kocv97RA== From: Mike Rapoport To: Andrew Morton 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-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v4 1/4] include/linux/mmzone.h: add documentation for pfn_valid() Date: Tue, 11 May 2021 13:05:47 +0300 Message-Id: <20210511100550.28178-2-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20210511100550.28178-1-rppt@kernel.org> References: <20210511100550.28178-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport Add comment describing the semantics of pfn_valid() that clarifies that pfn_valid() only checks for availability of a memory map entry (i.e. struct page) for a PFN rather than availability of usable memory backing that PFN. The most "generic" version of pfn_valid() used by the configurations with SPARSEMEM enabled resides in include/linux/mmzone.h so this is the most suitable place for documentation about semantics of pfn_valid(). Suggested-by: Anshuman Khandual Signed-off-by: Mike Rapoport Reviewed-by: Anshuman Khandual --- include/linux/mmzone.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 0d53eba1c383..e5945ca24df7 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1427,6 +1427,17 @@ static inline int pfn_section_valid(struct mem_section *ms, unsigned long pfn) #endif #ifndef CONFIG_HAVE_ARCH_PFN_VALID +/** + * pfn_valid - check if there is a valid memory map entry for a PFN + * @pfn: the page frame number to check + * + * Check if there is a valid memory map entry aka struct page for the @pfn. + * Note, that availability of the memory map entry does not imply that + * there is actual usable memory at that @pfn. The struct page may + * represent a hole or an unusable page frame. + * + * Return: 1 for PFNs that have memory map entries and 0 otherwise + */ static inline int pfn_valid(unsigned long pfn) { struct mem_section *ms; -- 2.28.0