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=-17.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 1EBD2C433B4 for ; Tue, 20 Apr 2021 09:23:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 84AEA6135F for ; Tue, 20 Apr 2021 09:23:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84AEA6135F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DC01F6B0036; Tue, 20 Apr 2021 05:23:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D6FF56B006E; Tue, 20 Apr 2021 05:23:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE9386B0070; Tue, 20 Apr 2021 05:23:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 9F3BB6B0036 for ; Tue, 20 Apr 2021 05:23:03 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 518DC2C6D for ; Tue, 20 Apr 2021 09:23:03 +0000 (UTC) X-FDA: 78052206246.30.85EF469 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 58CAF80192EB for ; Tue, 20 Apr 2021 09:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618910582; 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=ix5YDMmXJ3C1/BneKisaiFbJVja4N1CpmLxhrOr+FWA=; b=T1xvWNeIyPYaVf+bM3mQQVaoA6vxGazYBlLgonCy4muMVFcRrWzpfN8StGG3MScwQIVM/V QApTTDlHR1L0OWW3miL0omBknCOXRpuBTPjuOaQlOFYiAlfGTcDf37dJ1tw2A1amfLZUKQ P1qfmiK/AZ1pQRvHvPCOE8kZTM9ZYI4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-v0dyEn2IMnOsdGjDLHUF-w-1; Tue, 20 Apr 2021 05:22:55 -0400 X-MC-Unique: v0dyEn2IMnOsdGjDLHUF-w-1 Received: by mail-wr1-f69.google.com with SMTP id 32-20020adf84230000b029010705438fbfso5453814wrf.21 for ; Tue, 20 Apr 2021 02:22:55 -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=ix5YDMmXJ3C1/BneKisaiFbJVja4N1CpmLxhrOr+FWA=; b=F4VNdoA6nGe95vLO1tXytdbYYVvAe7nl1RbnpkeDF332ESlhip+WHxYXm15ttvDUba vlT0rO8PfHqe1dGtYRWh0sTrVqRYp8n6aaoXUDxz5SJ5e//kDCE0ffOtIPh3Oh5aSN95 Jg+6nXpc80bt4OEZds7ZfUe1IdHGOcVy4cZDvIE0x2Bi26Rw3vk0LZyHWKm3VrPaE6e7 RM/jpwki8NZ8BGH+rmdiEhxiVIjAgz9AzlT4vkBYNTYsMiqZ7RGvt6me6+Obvr0d11KT dCLXsTLdjiepVzBqDS1BUD6tsGf0L1jaTR6I73bltVXV6GkYZiLvdMKl4pXzzlPSIESP nOvA== X-Gm-Message-State: AOAM532v0jueO5xSSkAmuquF9nCp4IigJgaRiasgUmrQvL1BAmJS4PxM jVtL2q6TMRDWrY4mNkmH8GHn/s+/pWcq6/iwPl78uYcVkZ6j83rxB8rDOuCVYI9VbL+HyxoTG2c 68q+1/8AlVn3ToPS9rSFjlDajmvO3P1mdCPn2mt+Y4T6t5QrMag9Az1y5Y3g= X-Received: by 2002:a1c:c911:: with SMTP id f17mr3456353wmb.45.1618910574556; Tue, 20 Apr 2021 02:22:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyds3aZGiGfNhY717LR9Fd18v+z+0WjKZswcFhDMLESmpRmh8l/f3c9okYjlf6HDlj+DWj7Ug== X-Received: by 2002:a1c:c911:: with SMTP id f17mr3456313wmb.45.1618910574180; Tue, 20 Apr 2021 02:22: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 g13sm30774192wrr.9.2021.04.20.02.22.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Apr 2021 02:22:53 -0700 (PDT) Subject: Re: [PATCH v1 1/4] include/linux/mmzone.h: add documentation for pfn_valid() To: Mike Rapoport , linux-arm-kernel@lists.infradead.org Cc: 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: Date: Tue, 20 Apr 2021 11:22:53 +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: <20210420090925.7457-2-rppt@kernel.org> 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-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Stat-Signature: hqq7rpa3g6edog81uzj9t6k8chguxxrb X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 58CAF80192EB Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=170.10.133.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618910564-646460 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 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. -- Thanks, David / dhildenb