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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 E07FBC433ED for ; Wed, 21 Apr 2021 06:51:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C55DA61424 for ; Wed, 21 Apr 2021 06:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236277AbhDUGvz (ORCPT ); Wed, 21 Apr 2021 02:51:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:54248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236246AbhDUGvx (ORCPT ); Wed, 21 Apr 2021 02:51:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E93361428; Wed, 21 Apr 2021 06:51:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618987880; bh=Qi6LdBTlLuOVuNcp6ddeBrW8xIediedEVTnPkga7Anc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0HTEbj4cUiKNPef5hTCPqlmjrS7YAj9LhZ8f8oCk6ndpXorjNCYK37yorCoepSae qyoClHG2E59gApHvUP4vvznXZbmEDeAkASHd99j1vhQ3dU5e25pFIdGqnYjPHJb2dA 44oB3QviXTlWO9ozgNIoaySbgZ0xg72v08ealZmOoJiJPfu3VEww+W7Gdi5BK23KQ1 vI29v0YnzqvPdg8OMA5o3sj0oWFvPHGs2FXVPvuCt+M/R+s2s86pDn9FUMMHHWZR4R OW4G/4ZG77zKncLwtkeXwaYXvRNmOm0J+yXvtG8TC+usiLRECUuxTzExcmmmDYWNbg 8AUiSD9dW/6WA== 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 1/4] include/linux/mmzone.h: add documentation for pfn_valid() Date: Wed, 21 Apr 2021 09:51:05 +0300 Message-Id: <20210421065108.1987-2-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 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 --- include/linux/mmzone.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 47946cec7584..961f0eeefb62 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1410,6 +1410,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