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