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=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 56F21C433B4 for ; Tue, 20 Apr 2021 13:01:16 +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 ABC9A613CD for ; Tue, 20 Apr 2021 13:01:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ABC9A613CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8SScrwciDGGxLL5c5p1ZDRVGWppzkXYLE86K+SAtP3Q=; b=OTgXJEAcmjDr4Ex95cDlJj0BR N/H9N5HlSVwgMjJwnsV+mAy4vIUbJG+vswmKK7Yr1CFkOdqAhVpuY5qBDj4K6VScCu9K+aSE5CJ3j nf6djH0Q5xH6SU3u3nqXY2mLxCrGoMhi/b3NJTOk75mnk3yTFeDMswailjI8Qe2rZyrHpTk/VZhRq Sg/IalfW2RcahHdah7BszwI3WoKxz52n4VSwqLK221Eu8/V+21WCWs+r0r1BaT1EFsS3CqmycB8Tv Y3qv8cDcunhnteBWxKTHNwqzVjAUiKRPcO61zv0qrUWjv8lA2dXIzKVIBhDRZfqmMUNOzfYb/YhHe lbix1G7hg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYpyC-00C8tb-Tn; Tue, 20 Apr 2021 12:59:13 +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 1lYpy8-00C8t0-ER for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 12:59:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=InC/09SU2jowBshG+H/mXghIo0fijTDczsPvBvuygWs=; b=CKpYgMN6+JuMlRRKjkECtbyCak Gi6n6qpIqSY+VyR9EMLaIg7YKKtqZf01o4tTqOcMyCnqp2dtYtl3+3Qg1IvKzU4upT3gyIwE4qEVO NCO6Wh+0PhDeH8ZzmPuKh8RkechF2hOzqrz2HkgmLnC55gGgAbaSMQ0Hkz9qf20UWSxzLCEihP5gI RnX4Ankg0aWEbT5765t72SAlTUd6X3ZywlinNx9ZGizqjc+Wf4fPgSv9bgXe+bNCFboZQ+1JVDgT1 dXVTFrqGKcZioZAiPizofN2KwlrZOxA1hfvq4z27fLV4rfHUYzep9/uI4jibKf6cEuovnQ/UxFQQW sn601Miw==; Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYpy2-00C7Vk-Vo for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 12:59:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618923540; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=InC/09SU2jowBshG+H/mXghIo0fijTDczsPvBvuygWs=; b=DiKo1DIxyibzI/0YOp+CsLSwv/joVX2QNGmkKFWNraylcG2SRl05ClVGX3YwpeSF83or/B Pq1iwipFIIGY3PyWuv00TWgWU/qGgecQ+wFQKs+5/u9ugBKEUh6SO4Z0pWuyxfYKWkJRhM TecGV0drjXPpgZTJA/Jl5Sia7R9Xrus= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-xUOcY1R7MwS8XHbOdBR-FQ-1; Tue, 20 Apr 2021 08:58:56 -0400 X-MC-Unique: xUOcY1R7MwS8XHbOdBR-FQ-1 Received: by mail-wr1-f72.google.com with SMTP id 91-20020adf92640000b02901060747826eso9067519wrj.13 for ; Tue, 20 Apr 2021 05:58:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=InC/09SU2jowBshG+H/mXghIo0fijTDczsPvBvuygWs=; b=kzISSNf5GBw+JoVA6sb7ANbLYKuLWEcUIcUA2TaLGgL+jvGOzwkQnaMCWvgWVw2/AY HV+I+Hhv/gvAztOKJu1xKR39aHXs/HODFWoM2tIc4i78w+7jYVjmFcTqUIfvFD2i9Mz7 7YAkcSHw2arAEhD8tyazRPm9NjJpUw3W6rMiBrPEV58QD0caSVZOQx+Rd+mLyLenfAjn dwFj/01DISGqta7kCA9H6mIpbUYAf8qCNXxs+GMtEXnUlb9kravnfJ+Mzwtq46k5fjR2 l0+Z4ojFLPeDrL7zbj42SW7OYe80kEy+2D48Mm1k2JPtQtTgkKjWwClI0Nay1Ho+chpz VrhA== X-Gm-Message-State: AOAM531Z1/Pu0On/L3Yrnogyzl9xjWRqqH1S7jWqY22eBCCcdTyaaOkD 68DF/CWWKou7wxeL2yLeiiLf9egFWXt2HWMK2EI8H4oyb9OauliKaeOLTbSFQtOSo0aGTxeiol8 aUC/oSRmMl4TDtkoFNHXRlWfcl/V3y6MDVrs= X-Received: by 2002:a1c:454:: with SMTP id 81mr4372373wme.186.1618923535248; Tue, 20 Apr 2021 05:58:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzN432Bkl8h0VlShbz+ZgmHfmV79yLlF8E3/1xyjGalQUC9+ROSAJDjYzCWA1CcV6ig2Ye5wQ== X-Received: by 2002:a1c:454:: with SMTP id 81mr4372354wme.186.1618923534988; Tue, 20 Apr 2021 05:58:54 -0700 (PDT) Received: from [192.168.3.132] (p4ff2390a.dip0.t-ipconnect.de. [79.242.57.10]) by smtp.gmail.com with ESMTPSA id x2sm30458360wrg.31.2021.04.20.05.58.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Apr 2021 05:58:54 -0700 (PDT) Subject: Re: [PATCH v1 1/4] include/linux/mmzone.h: add documentation for pfn_valid() To: Mike Rapoport 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 References: <20210420090925.7457-1-rppt@kernel.org> <20210420090925.7457-2-rppt@kernel.org> From: David Hildenbrand Organization: Red Hat Message-ID: <07216f89-369f-0dcc-7bc0-97c204981396@redhat.com> Date: Tue, 20 Apr 2021 14:58:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_055903_111715_186B8D2E X-CRM114-Status: GOOD ( 26.01 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 20.04.21 14:57, Mike Rapoport wrote: > 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. > */ > Sounds good to me -- thanks! Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel