linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Jörg Rödel" <joro@8bytes.org>
To: Mostafa Saleh <smostafa@google.com>
Cc: linux-mm@kvack.org, iommu@lists.linux.dev,
	 linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	corbet@lwn.net, will@kernel.org,  robin.murphy@arm.com,
	akpm@linux-foundation.org, vbabka@suse.cz, surenb@google.com,
	 mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org,
	ziy@nvidia.com,  david@redhat.com, lorenzo.stoakes@oracle.com,
	Liam.Howlett@oracle.com,  rppt@kernel.org, xiaqinxin@huawei.com,
	baolu.lu@linux.intel.com,  rdunlap@infradead.org
Subject: Re: [PATCH 1/2] mm/page_ext: Add page_ext_get_phys()
Date: Mon, 19 Jan 2026 16:48:59 +0100	[thread overview]
Message-ID: <qu5oksvcaytolppeeale6rwf4bzvckvfdg3iw77kowrg4fn24a@p4hmieukkttu> (raw)
In-Reply-To: <20260119142246.3821052-2-smostafa@google.com>

On Mon, Jan 19, 2026 at 02:22:45PM +0000, Mostafa Saleh wrote:
> +static inline struct page_ext *page_ext_get_phys(phys_addr_t phys)

The name is misleading as it indicates that the function returns a physical
address. Maybe name it page_ext_from_phys()?

> +{
> +	return NULL;
> +}
> +
>  static inline void page_ext_put(struct page_ext *page_ext)
>  {
>  }
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index 297e4cd8ce90..5fe65a0ac4f3 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -538,6 +538,29 @@ struct page_ext *page_ext_get(const struct page *page)
>  	return page_ext;
>  }
>  
> +/**
> + * page_ext_get_phys() - Get the page_ext structure for a physical address.
> + * @phys: The physical address to query.
> + *
> + * This function safely gets the `struct page_ext` associated with a given
> + * physical address. It performs validation to ensure the address corresponds
> + * to a valid, online struct page before attempting to access it.
> + * It should return NULL for (MMIO, ZONE_DEVICE, holes, offline memory)

It should?

-Joerg


  reply	other threads:[~2026-01-19 15:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19 14:22 [PATCH 0/2] iommu: debug-pagealloc: Remove pfn_valid() usage Mostafa Saleh
2026-01-19 14:22 ` [PATCH 1/2] mm/page_ext: Add page_ext_get_phys() Mostafa Saleh
2026-01-19 15:48   ` Jörg Rödel [this message]
2026-01-19 15:55     ` Mostafa Saleh
2026-01-19 14:22 ` [PATCH 2/2] iommu: debug-pagealloc: Use page_ext_get_phys() Mostafa Saleh
2026-01-19 14:26 ` [PATCH 0/2] iommu: debug-pagealloc: Remove pfn_valid() usage David Hildenbrand (Red Hat)
2026-01-19 15:09   ` Mostafa Saleh
2026-01-19 15:16     ` David Hildenbrand (Red Hat)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=qu5oksvcaytolppeeale6rwf4bzvckvfdg3iw77kowrg4fn24a@p4hmieukkttu \
    --to=joro@8bytes.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolu.lu@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=iommu@lists.linux.dev \
    --cc=jackmanb@google.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhocko@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=robin.murphy@arm.com \
    --cc=rppt@kernel.org \
    --cc=smostafa@google.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --cc=will@kernel.org \
    --cc=xiaqinxin@huawei.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox