Hi,

On 1/9/26 10:54, Francois Dugast wrote:

> From: Matthew Brost <[email protected]>
>
> Split device-private and coherent folios into individual pages before
> freeing so that any order folio can be formed upon the next use of the
> pages.
>
> Cc: Balbir Singh <[email protected]>
> Cc: Alistair Popple <[email protected]>
> Cc: Zi Yan <[email protected]>
> Cc: David Hildenbrand <[email protected]>
> Cc: Oscar Salvador <[email protected]>
> Cc: Andrew Morton <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Matthew Brost <[email protected]>
> Signed-off-by: Francois Dugast <[email protected]>
> ---
>  mm/memremap.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/memremap.c b/mm/memremap.c
> index 63c6ab4fdf08..7289cdd6862f 100644
> --- a/mm/memremap.c
> +++ b/mm/memremap.c
> @@ -453,6 +453,8 @@ void free_zone_device_folio(struct folio *folio)
>       case MEMORY_DEVICE_COHERENT:
>               if (WARN_ON_ONCE(!pgmap->ops || !pgmap->ops->folio_free))
>                       break;
> +
> +             folio_split_unref(folio);
>               pgmap->ops->folio_free(folio);
>               percpu_ref_put_many(&folio->pgmap->ref, nr);
>               break;

This breaks folio_free implementations like nouveau_dmem_folio_free
which checks the folio order and act upon that.
Maybe add an order parameter to folio_free or let the driver handle the split?

Thanks,
Mika

Reply via email to