From: "Mika Penttilä" <mpenttil@redhat.com>
To: David Hildenbrand <david@redhat.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: Alistair Popple <apopple@nvidia.com>,
John Hubbard <jhubbard@nvidia.com>,
Ralph Campbell <rcampbell@nvidia.com>,
"Huang, Ying" <ying.huang@intel.com>
Subject: Re: [PATCH v3] mm/migrate_device: Try to handle swapcache pages
Date: Tue, 6 Jun 2023 10:59:58 +0300 [thread overview]
Message-ID: <b33de1f0-0f6f-5789-3f1e-6e43304d3c63@redhat.com> (raw)
In-Reply-To: <160264d0-8110-bda3-eb77-381ac9482dd6@redhat.com>
Hi,
On 6.6.2023 10.46, David Hildenbrand wrote:
> On 06.06.23 09:44, David Hildenbrand wrote:
>> On 06.06.23 07:01, mpenttil@redhat.com wrote:
>>> From: Mika Penttilä <mpenttil@redhat.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@nvidia.com>
>>> Cc: John Hubbard <jhubbard@nvidia.com>
>>> Cc: Ralph Campbell <rcampbell@nvidia.com>
>>> Cc: "Huang, Ying" <ying.huang@intel.com>
>>> Reviewed-by: "Huang, Ying" <ying.huang@intel.com>
>>> Reviewed-by: Alistair Popple <apopple@nvidia.com>
>>> Signed-off-by: Mika Penttilä <mpenttil@redhat.com>
>>> ---
>>>
>>> v3:
>>> - Adjust comments
>>> - Add Reviewed-bys
>>>
>>> v2:
>>> - use folio_test_anon() (Huang, Ying)
>>>
>>> mm/migrate_device.c | 22 ++++++++++++++++------
>>> 1 file changed, 16 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
>>> index d30c9de60b0d..f76ebccfe067 100644
>>> --- a/mm/migrate_device.c
>>> +++ b/mm/migrate_device.c
>>> @@ -747,13 +747,23 @@ 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.
>>> + *
>>> + */
>>> + if (!folio_test_anon(folio) ||
>>> !folio_free_swap(folio)) {
>>> + src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
>>> + continue;
>>
>> I'm pretty sure the folio has to be locked in order to call
>> folio_free_swap().
>>
>
> Oh, staring at the bigger context, I assume we locked the folios via
> migrate_device_range(), correct?
>
Yes either that, or when migrating via virtual addresses
migrate_vma_collect_pmd() has trylock_page() and we migrate only pages
which succeed locking.
--Mika
next prev parent reply other threads:[~2023-06-06 8:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 5:01 mpenttil
2023-06-06 7:44 ` David Hildenbrand
2023-06-06 7:46 ` David Hildenbrand
2023-06-06 7:59 ` Mika Penttilä [this message]
2023-06-07 14:10 ` Christoph Hellwig
2023-06-07 15:56 ` Mika Penttilä
2023-06-07 16:06 ` Mika Penttilä
2023-06-12 4:53 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b33de1f0-0f6f-5789-3f1e-6e43304d3c63@redhat.com \
--to=mpenttil@redhat.com \
--cc=apopple@nvidia.com \
--cc=david@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rcampbell@nvidia.com \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®