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=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 B6745C433ED for ; Tue, 20 Apr 2021 12:58:12 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 0B3F7613CD for ; Tue, 20 Apr 2021 12:58:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B3F7613CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 6F1144B3A7; Tue, 20 Apr 2021 08:58:11 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PFkGm8KbcxAO; Tue, 20 Apr 2021 08:58:10 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 196D84B396; Tue, 20 Apr 2021 08:58:10 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id DCDB24B396 for ; Tue, 20 Apr 2021 08:58:08 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wVZcgDjbHUbL for ; Tue, 20 Apr 2021 08:58:04 -0400 (EDT) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 552754B38E for ; Tue, 20 Apr 2021 08:58:04 -0400 (EDT) Received: by mail.kernel.org (Postfix) with ESMTPSA id 89A4A613C3; Tue, 20 Apr 2021 12:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618923481; bh=pj7iH5/7ryvKV0103e/WzDqoTVMCnCeOsU1aueXSSWs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AELGbPakwwA189udgGAWTMEERvHJSzMiJJ6zXc+pUHeHypJdz0V2fLe+BD1bzM3Nx u9j/1K2l5BkbehD9ogeiYm7EMiRtZo3pybYvM6cZGY5LcQAnHIi9VRZ7v8vxG+stQK GZ2TdxDIffeM0R+97tZrgAqWdhdoTu45VU5HxgOq9PfOoGh0glAUuurDI2Bad4nDOo KZECeDYreSNaGkVAIyk8uMOKfQSmqol2Tr19JuTT7Jw0eQB08RumVkZeFP3Qz2yLts SHCbpptQUT2ALWZS3QX0qSFE7JldhhO5+xK9SIm7k9tZyQCR2vjrXrovnnIkVMTz5M Ap+IrrXFwGzUw== Date: Tue, 20 Apr 2021 15:57:52 +0300 From: Mike Rapoport To: David Hildenbrand Subject: Re: [PATCH v1 1/4] include/linux/mmzone.h: add documentation for pfn_valid() Message-ID: References: <20210420090925.7457-1-rppt@kernel.org> <20210420090925.7457-2-rppt@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Cc: Anshuman Khandual , Catalin Marinas , linux-kernel@vger.kernel.org, Mike Rapoport , linux-mm@kvack.org, kvmarm@lists.cs.columbia.edu, Marc Zyngier , Will Deacon , linux-arm-kernel@lists.infradead.org X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Tue, Apr 20, 2021 at 11:22:53AM +0200, David Hildenbrand wrote: > On 20.04.21 11:09, Mike Rapoport wrote: > > 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; > > > > I'd rephrase all "there is a valid memory map" to "there is a memory map" > and add "pfn_valid() does to indicate whether the memory map as actually > initialized -- see pfn_to_online_page()." > > pfn_valid() means that we can do a pfn_to_page() and don't get a fault when > accessing the "struct page". It doesn't state anything about the content. Well, I mean valid in the sense you can access the struct page :) How about: /** * pfn_valid - check if there is a memory map entry for a PFN * @pfn: the page frame number to check * * Check if there is a memory map entry aka struct page for the @pfn and it * is safe to access that struct page; the struct page state may be * uninitialized -- see pfn_to_online_page(). * * 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. */ -- Sincerely yours, Mike. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 3D449C43461 for ; Tue, 20 Apr 2021 13:00:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81F2B613C8 for ; Tue, 20 Apr 2021 13:00:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81F2B613C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IqxK8OUHyAZi9njBqHdy1bFp/lAkoq1qKehVSGIpmVU=; b=NY5Yf6j3q/e9qw0vFf2wLNpfF JHMXiDZoAhGWli6jWDZ05CwMysprCt/ngzT5DNx7nvjlBfJQSPh1Vr0Av1tbbpGojcV1m1RHc8W+H +KJEV9M3CMwmikwi47UlpL9jqACSXDRitDqB5AGtsMeNLdQQLKC4TQUygrbC3iuRou/6WMcqFO9Kw It/2ZmUgCXEfjrPZx+p6EHZn8er36t7WG1PGyP+YqalNpVjk1Z8xpOxOwj3W9deGDLM+AEDH0l7V4 ZJ10VBUP4+Q8XjgG0/yyAWStb1vbyggzLeeXebdNeOV1CJQzP2U2YAt8ZqyyPDG3VM9bdWAV3hi4x UipcrsJkg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYpxC-00C8mJ-9f; Tue, 20 Apr 2021 12:58:10 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYpx9-00C8m1-Qx for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 12:58:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=Mw+izul29OPSu2Fl+rl7wS/BMz5c+Cn7Ko5XHTz+4Rw=; b=jG2bpNvW/kfHkNb8MlpuIt5gLU jUKD/oWvVnehZmRVVW3kpepm6tKuiefmCOTOLJx6DLXiGDuxcxRreacCghpKbV+HEWYyg5YMTzPAt 8Fe9wcdRcdcEThz0wHPuiW1whlPwATF8XOlj5bkC16VuHDLNUrT/jD2Gnlktijsj1TCJPdARfHx4Q ifi58tUi6SpPm5P/I0rQHw/0WVrD0YfAq9mQLbYbYHaBFpRbwyJPxJ/1fmrzhh44C8ED3varggBxy l7e1F8/ISmICKYGhCRiSHYRU20FXPN6xibTVPcmSfYDEMTmxIMvXWXGdKmADg9GQdMmbclK22aNnS 8JeA8PoA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYpx4-00C7Sl-1h for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 12:58:06 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 89A4A613C3; Tue, 20 Apr 2021 12:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618923481; bh=pj7iH5/7ryvKV0103e/WzDqoTVMCnCeOsU1aueXSSWs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AELGbPakwwA189udgGAWTMEERvHJSzMiJJ6zXc+pUHeHypJdz0V2fLe+BD1bzM3Nx u9j/1K2l5BkbehD9ogeiYm7EMiRtZo3pybYvM6cZGY5LcQAnHIi9VRZ7v8vxG+stQK GZ2TdxDIffeM0R+97tZrgAqWdhdoTu45VU5HxgOq9PfOoGh0glAUuurDI2Bad4nDOo KZECeDYreSNaGkVAIyk8uMOKfQSmqol2Tr19JuTT7Jw0eQB08RumVkZeFP3Qz2yLts SHCbpptQUT2ALWZS3QX0qSFE7JldhhO5+xK9SIm7k9tZyQCR2vjrXrovnnIkVMTz5M Ap+IrrXFwGzUw== Date: Tue, 20 Apr 2021 15:57:52 +0300 From: Mike Rapoport To: David Hildenbrand Cc: linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , Marc Zyngier , Mark Rutland , Mike Rapoport , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 1/4] include/linux/mmzone.h: add documentation for pfn_valid() Message-ID: References: <20210420090925.7457-1-rppt@kernel.org> <20210420090925.7457-2-rppt@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_055802_180319_FF64A749 X-CRM114-Status: GOOD ( 26.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 20, 2021 at 11:22:53AM +0200, David Hildenbrand wrote: > On 20.04.21 11:09, Mike Rapoport wrote: > > 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; > > > > I'd rephrase all "there is a valid memory map" to "there is a memory map" > and add "pfn_valid() does to indicate whether the memory map as actually > initialized -- see pfn_to_online_page()." > > pfn_valid() means that we can do a pfn_to_page() and don't get a fault when > accessing the "struct page". It doesn't state anything about the content. Well, I mean valid in the sense you can access the struct page :) How about: /** * pfn_valid - check if there is a memory map entry for a PFN * @pfn: the page frame number to check * * Check if there is a memory map entry aka struct page for the @pfn and it * is safe to access that struct page; the struct page state may be * uninitialized -- see pfn_to_online_page(). * * 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. */ -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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.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 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 50534C433ED for ; Tue, 20 Apr 2021 12:58:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 989E4613C8 for ; Tue, 20 Apr 2021 12:58:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 989E4613C8 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 A5A976B006C; Tue, 20 Apr 2021 08:58:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A320B6B006E; Tue, 20 Apr 2021 08:58:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 921C76B0070; Tue, 20 Apr 2021 08:58:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0180.hostedemail.com [216.40.44.180]) by kanga.kvack.org (Postfix) with ESMTP id 752756B006C for ; Tue, 20 Apr 2021 08:58:03 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 3A1758249980 for ; Tue, 20 Apr 2021 12:58:03 +0000 (UTC) X-FDA: 78052748046.26.4440D4C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id C779140002DF for ; Tue, 20 Apr 2021 12:57:56 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 89A4A613C3; Tue, 20 Apr 2021 12:57:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618923481; bh=pj7iH5/7ryvKV0103e/WzDqoTVMCnCeOsU1aueXSSWs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AELGbPakwwA189udgGAWTMEERvHJSzMiJJ6zXc+pUHeHypJdz0V2fLe+BD1bzM3Nx u9j/1K2l5BkbehD9ogeiYm7EMiRtZo3pybYvM6cZGY5LcQAnHIi9VRZ7v8vxG+stQK GZ2TdxDIffeM0R+97tZrgAqWdhdoTu45VU5HxgOq9PfOoGh0glAUuurDI2Bad4nDOo KZECeDYreSNaGkVAIyk8uMOKfQSmqol2Tr19JuTT7Jw0eQB08RumVkZeFP3Qz2yLts SHCbpptQUT2ALWZS3QX0qSFE7JldhhO5+xK9SIm7k9tZyQCR2vjrXrovnnIkVMTz5M Ap+IrrXFwGzUw== Date: Tue, 20 Apr 2021 15:57:52 +0300 From: Mike Rapoport To: David Hildenbrand Cc: linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , Marc Zyngier , Mark Rutland , Mike Rapoport , Will Deacon , kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v1 1/4] include/linux/mmzone.h: add documentation for pfn_valid() Message-ID: References: <20210420090925.7457-1-rppt@kernel.org> <20210420090925.7457-2-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: C779140002DF X-Stat-Signature: ogwedyo4p5ybami57ki138ouk1pb48c3 X-Rspamd-Server: rspam02 Received-SPF: none (kernel.org>: No applicable sender policy available) receiver=imf26; identity=mailfrom; envelope-from=""; helo=mail.kernel.org; client-ip=198.145.29.99 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618923476-864457 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: On Tue, Apr 20, 2021 at 11:22:53AM +0200, David Hildenbrand wrote: > On 20.04.21 11:09, Mike Rapoport wrote: > > 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; > > > > I'd rephrase all "there is a valid memory map" to "there is a memory map" > and add "pfn_valid() does to indicate whether the memory map as actually > initialized -- see pfn_to_online_page()." > > pfn_valid() means that we can do a pfn_to_page() and don't get a fault when > accessing the "struct page". It doesn't state anything about the content. Well, I mean valid in the sense you can access the struct page :) How about: /** * pfn_valid - check if there is a memory map entry for a PFN * @pfn: the page frame number to check * * Check if there is a memory map entry aka struct page for the @pfn and it * is safe to access that struct page; the struct page state may be * uninitialized -- see pfn_to_online_page(). * * 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. */ -- Sincerely yours, Mike.