Re: [PATCH 1/4] mm/damon: defensively skip zone device folios in damon_get_folio()

Gregory Price <[email protected]>
Newsgroups dev.linux.lists.damon,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <anS-vK1MaC8sWoMK@fedora>
On Thu, Aug 06, 2026 at 02:37:59PM +0100, Lorenzo Stoakes (ARM) wrote:
> On Tue, Jul 28, 2026 at 03:47:11PM -0400, Gregory Price wrote:
> > All DAMON physical- and virtual-address operations obtain their folios
> > through damon_get_folio(). That helper already excludes ZONE_DEVICE
> > memory implicitly via pfn_to_online_page() and folio_test_lru(), but
> > this is inconsistent with other callers in mm/ which test explicitly.
> >
> > Add an explicit folio_is_zone_device() rejection in damon_get_folio()
> > so the guarantee lives in one place and covers every caller uniformly,
> > consistent with other mm walkers that reject zone device folios.
> >
> > Signed-off-by: Gregory Price (Meta) <[email protected]>
> 
> Thanks, nice to make it explicit!
> 
> Acked-by: Lorenzo Stoakes (ARM) <[email protected]>
>

SJ Asked me to drop it, so I most likely will, but yeah - this exact
patch is a good example of how many footguns zone device gives us.

~Gregory
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.