Re: [PATCH 2/4] mm/huge_memory: skip zone device folios in madvise_free_huge_pmd()

Gregory Price <[email protected]>
Newsgroups dev.linux.lists.damon,org.kernel.vger.linux-kernel,org.kernel.vger.stable,org.kvack.linux-mm
Message-ID <anS-V-k61246FkkS@fedora>
On Thu, Aug 06, 2026 at 02:59:22PM +0100, Lorenzo Stoakes (ARM) wrote:
> I kinda wish he had some generalised folio handler like:
> 
> 	struct folio_ops {
> 		int (*handle_empty_entry)(void *priv);
> 		int (*handle_normal_folio)(void *priv, struct folio *folio);
> 		int (*handle_softleaf_pte_entry)(void *priv, const pte_t *ptep);
> 		int (*handle_zone_folio)(void *priv, struct folio *folio);
> 		...
> 	};
> 
> Or I don't know an equivalent type of thing, as we keep having these same
> patterns emerge in mm that are duplicated in a million places with slight
> variations... :)
> 
> I wonder if C is expressive enough to get us to something sane though.
> 

This is functionally folio->pgmap except it's not generalized and it
causes us pain :[

I briefly took a forray into moving pgmap to be node-scope, and that
works decently, but first i'm just trying to clena up what i can for
zone device.

Anyway, i get what you're getting at here, and that would be nice.

> > Fixes: 368076f52ebe ("mm/huge_memory: add device-private THP support to PMD operations")
> > Cc: <[email protected]>
> > Signed-off-by: Gregory Price (Meta) <[email protected]>
> 
> Anyway LGTM so:
> 
> Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]>
>

many thanks :]
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.