Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3387905pxj; Tue, 11 May 2021 03:26:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd4eR9byuuYnXYeRjPYTpxSL2wi7/sI3hQRntzkpUo3wFCowcWBevkBqQsUUA5GKDBVQ7l X-Received: by 2002:aa7:c413:: with SMTP id j19mr35440646edq.206.1620728786500; Tue, 11 May 2021 03:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620728786; cv=none; d=google.com; s=arc-20160816; b=hBqRHws6Z2LoTQNywGA7f0nMXrDlfAyhCmsDERqE1CeYEI2zW4vygSC8aDiQfuvun3 wLK4isKHG4K7oFqwfg4T98hHBFOWUDelj7n1BQMWJLtKC4amodfMU2RcVMdKnj0BrSse 2PKgxcs1mV1y6rxkzqD6pbrJamsWb8FM/lkD1NfBbdrt88WbvLud1m5glAnc0S2zhrjU WqOFaWxDg7egLWJOxWuo6unvjGlZcgyPAtWwtPQQzXaxSoWydMOhEyh7n3Pm62rrG8QU i2LfBxlBHpBKN2ikAXbYbYvtvW02i4sjgH9z6f/ji3ydqHrvZboQM4auWOrttk95LkCx vUTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cKDSd1U87bRZlDoYprb9BfZAYYOT+54epYQhxtfLHKM=; b=JFCd6z3OMA5OdYbzQYGo3/FW2HdODJSIxMlsfQKQQrMQGhM/LdUzG/YOSn69asu11g dnUVmDMZgoh+eQqreR0G5B/FL9tm5hItWQrphOisog18shTyKhBmgH47GQAVay1ZfIhj 4N9YJMmJ6aMwGNfyfdQEldKor4UuaJd8OwgjgGdEJ+Xd9oeJuq9Z3xMc3c8O3Io7tBm/ 8I26DfEONz+kYfHLXJZMGLTUJHjZueKBkgeYac96gFfS02zqOST/3mWBdj3yKEuZOyyn 0cGx2dAnSNnPApdxUsmmzeHIGU3Uv5B0FsWAf9KzRPK+fnxSfhTrD6V/PBhtfqfZeGKc 2DmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kfmrEf4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oy28si15338813ejb.412.2021.05.11.03.26.03; Tue, 11 May 2021 03:26:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kfmrEf4U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231355AbhEKKYC (ORCPT + 99 others); Tue, 11 May 2021 06:24:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:59034 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbhEKKYB (ORCPT ); Tue, 11 May 2021 06:24:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 458246192C for ; Tue, 11 May 2021 10:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620728575; bh=8K5/RKVsB4hbF+2S3xYY+Sls7rLDAQAlNlhNK+wAOxM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=kfmrEf4UUPFdXmN4bONIkgTnNm+NvLIuA5PwA2CwaYTxb1dDjpb/EJj7jzf3G1lQD nIb8iuIIEgctX84nf+w+HM4ez8mJ8I2el3imHgPUbBrVOHBIYCSrUucrRCUYBIl5sR oj7JeBjGYixV3xnxSGHcew4MdO2AoktCyJG9i3pn4u1nluL9dFAELEUbHsASk0gW3n NYTY2RE4iLWxmPJ9fLRQxFO5luOuFnQa0bVAyXfp9XdxBSCMB/iragnXUtE0mnpeGU RnKVF8Y9kKxgCuDKNkB/rFZ2rYHoOR7Bniz1tPOY9GSnS5n+Of6gvZc4a0k4tcauPY lK2AvxnMfA6Sg== Received: by mail-oi1-f179.google.com with SMTP id n184so18532849oia.12 for ; Tue, 11 May 2021 03:22:55 -0700 (PDT) X-Gm-Message-State: AOAM53275VwEGF5YJmDRPXScG44F4fop/rGa7bqJ1Q1v879JZJISX8zX ZcbM/7+peAGkwMWPQalgjbM83vwB58txdC8msvA= X-Received: by 2002:aca:4056:: with SMTP id n83mr2975600oia.47.1620728574417; Tue, 11 May 2021 03:22:54 -0700 (PDT) MIME-Version: 1.0 References: <20210511100550.28178-1-rppt@kernel.org> <20210511100550.28178-2-rppt@kernel.org> In-Reply-To: <20210511100550.28178-2-rppt@kernel.org> From: Ard Biesheuvel Date: Tue, 11 May 2021 12:22:43 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 1/4] include/linux/mmzone.h: add documentation for pfn_valid() To: Mike Rapoport Cc: Andrew Morton , Anshuman Khandual , Catalin Marinas , David Hildenbrand , Marc Zyngier , Mark Rutland , Mike Rapoport , Will Deacon , kvmarm , Linux ARM , Linux Kernel Mailing List , Linux Memory Management List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 May 2021 at 12:06, 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 > Reviewed-by: Anshuman Khandual Acked-by: Ard Biesheuvel > --- > include/linux/mmzone.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index 0d53eba1c383..e5945ca24df7 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -1427,6 +1427,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 >