[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87wn0npdnc.fsf@nvidia.com>
Date: Thu, 01 Jun 2023 22:25:35 +1000
From: Alistair Popple <apopple@...dia.com>
To: "Huang, Ying" <ying.huang@...el.com>
Cc: mpenttil@...hat.com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, John Hubbard <jhubbard@...dia.com>,
Ralph Campbell <rcampbell@...dia.com>
Subject: Re: [PATCH v2] mm/migrate_device: Try to handle swapcache pages
"Huang, Ying" <ying.huang@...el.com> writes:
> mpenttil@...hat.com writes:
>
>> From: Mika Penttilä <mpenttil@...hat.com>
>>
>> Migrating file pages and swapcache pages into device memory is not supported.
>> The decision is done based on page_mapping(). For now, swapcache pages are not migrated.
>>
>> Things can however be improved, for swapcache pages. Try to get rid of the swap cache,
>> and if successful, go ahead as with other anonymous pages.
>>
>> Cc: Alistair Popple <apopple@...dia.com>
>> Cc: John Hubbard <jhubbard@...dia.com>
>> Cc: Ralph Campbell <rcampbell@...dia.com>
>> Cc: Huang Ying <ying.huang@...el.com>
>> Signed-off-by: Mika Penttilä <mpenttil@...hat.com>
>> ---
>>
>> v2:
>> - use folio_test_anon() (Huang, Ying)
>>
>>
>> mm/migrate_device.c | 24 ++++++++++++++++++------
>> 1 file changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
>> index d30c9de60b0d..829bbc526758 100644
>> --- a/mm/migrate_device.c
>> +++ b/mm/migrate_device.c
>> @@ -747,13 +747,25 @@ static void __migrate_device_pages(unsigned long *src_pfns,
>>
>> if (is_device_private_page(newpage) ||
>> is_device_coherent_page(newpage)) {
>> - /*
>> - * For now only support anonymous memory migrating to
>> - * device private or coherent memory.
>> - */
>> +
>> if (mapping) {
>> - src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
>> - continue;
>> + struct folio *folio;
>> +
>> + folio = page_folio(page);
>> +
>> + /*
>> + * For now only support anonymous memory migrating to
>> + * device private or coherent memory.
>> + *
>> + * Try to get rid of swap cache if possible.
>
> I think we can delete the following 2 lines of comments. They add
> nothing except what code says already.
They are also a bit confusing, because a private file-backed mapping is
treated as anonymous so folio_test_anon() won't filter those
out.
I will test this tomorrow but the change looks good so please add:
Reviewed-by: Alistair Popple <apopple@...dia.com>
> Otherwise looks good to me.
>
> Reviewed-by: "Huang, Ying" <ying.huang@...el.com>
>
>> + * page is here file or swapcache page, could be shmem also
>> + * folio_test_anon() filters out file and shmem
>> + *
>> + */
>> + if (!folio_test_anon(folio) || !folio_free_swap(folio)) {
>> + src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
>> + continue;
>> + }
>> }
>> } else if (is_zone_device_page(newpage)) {
>> /*
Powered by blists - more mailing lists