[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DF5A6B81-7811-4654-855F-8EAB76CCCE51@nvidia.com>
Date: Fri, 09 Jan 2026 12:28:22 -0500
From: Zi Yan <ziy@...dia.com>
To: Mika Penttilä <mpenttil@...hat.com>
Cc: Francois Dugast <francois.dugast@...el.com>,
intel-xe@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
Matthew Brost <matthew.brost@...el.com>, Balbir Singh <balbirs@...dia.com>,
Alistair Popple <apopple@...dia.com>, David Hildenbrand <david@...nel.org>,
Oscar Salvador <osalvador@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/7] mm: Split device-private and coherent folios
before freeing
On 9 Jan 2026, at 6:09, Mika Penttilä wrote:
> Hi,
>
> On 1/9/26 10:54, Francois Dugast wrote:
>
>> From: Matthew Brost <matthew.brost@...el.com>
>>
>> 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 <balbirs@...dia.com>
>> Cc: Alistair Popple <apopple@...dia.com>
>> Cc: Zi Yan <ziy@...dia.com>
>> Cc: David Hildenbrand <david@...nel.org>
>> Cc: Oscar Salvador <osalvador@...e.de>
>> Cc: Andrew Morton <akpm@...ux-foundation.org>
>> Cc: linux-mm@...ck.org
>> Cc: linux-cxl@...r.kernel.org
>> Cc: linux-kernel@...r.kernel.org
>> Signed-off-by: Matthew Brost <matthew.brost@...el.com>
>> Signed-off-by: Francois Dugast <francois.dugast@...el.com>
>> ---
>> 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?
Passing an order parameter might be better to avoid exposing core MM internals
by asking drivers to undo compound pages.
Best Regards,
Yan, Zi
Powered by blists - more mailing lists