From: "Huang, Ying" <ying.huang@intel.com>
To: mpenttil@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
apopple@nvidia.com, jhubbard@nvidia.com, rcampbell@nvidia.com
Subject: Re: [PATCH] mm/migrate_device: Try to handle swapcache pages.
Date: Mon, 08 May 2023 10:26:16 +0800 [thread overview]
Message-ID: <87wn1ja793.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <20230507061726.13422-1-mpenttil@redhat.com> (mpenttil@redhat.com's message of "Sun, 7 May 2023 09:17:26 +0300")
mpenttil@redhat.com writes:
> 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.
>
> As a detail, do not mess with shmem pages, as they handle swap internally.
>
> Cc: Alistair Popple <apopple@nvidia.com>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Ralph Campbell <rcampbell@nvidia.com>
> Signed-off-by: Mika Penttilä <mpenttil@redhat.com>
> ---
> mm/migrate_device.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/mm/migrate_device.c b/mm/migrate_device.c
> index d30c9de60b0d..e8169c58c341 100644
> --- a/mm/migrate_device.c
> +++ b/mm/migrate_device.c
> @@ -12,6 +12,7 @@
> #include <linux/mmu_notifier.h>
> #include <linux/oom.h>
> #include <linux/pagewalk.h>
> +#include <linux/shmem_fs.h>
> #include <linux/rmap.h>
> #include <linux/swapops.h>
> #include <asm/tlbflush.h>
> @@ -750,10 +751,17 @@ static void __migrate_device_pages(unsigned long *src_pfns,
> /*
> * For now only support anonymous memory migrating to
> * device private or coherent memory.
> + *
> + * Try to get rid of swap cache if possible.
> + * Leave shmem pages alone, they handle swap internally
> + *
> */
> if (mapping) {
> - src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
> - continue;
> + if (shmem_mapping(mapping) ||
> + !folio_free_swap(page_folio(page))) {
Should we filter out file pages firstly?
> + src_pfns[i] &= ~MIGRATE_PFN_MIGRATE;
> + continue;
> + }
> }
> } else if (is_zone_device_page(newpage)) {
> /*
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2023-05-08 2:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-07 6:17 mpenttil
2023-05-08 2:26 ` Huang, Ying [this message]
2023-05-08 2:59 ` Mika Penttilä
2023-05-08 5:14 ` Huang, Ying
2023-05-08 5:57 ` Mika Penttilä
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=87wn1ja793.fsf@yhuang6-desk2.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=apopple@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mpenttil@redhat.com \
--cc=rcampbell@nvidia.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