From: Alistair Popple <apopple@nvidia.com>
To: Alex Sierra <alex.sierra@amd.com>
Cc: rcampbell@nvidia.com, willy@infradead.org, david@redhat.com,
Felix.Kuehling@amd.com, amd-gfx@lists.freedesktop.org,
linux-xfs@vger.kernel.org, linux-mm@kvack.org,
jglisse@redhat.com, dri-devel@lists.freedesktop.org,
jgg@nvidia.com, akpm@linux-foundation.org,
linux-ext4@vger.kernel.org, hch@lst.de
Subject: Re: [PATCH v1 01/15] mm: add zone device coherent type memory support
Date: Thu, 12 May 2022 12:58:00 +1000 [thread overview]
Message-ID: <87bkw3qwc8.fsf@nvdebian.thelocal> (raw)
In-Reply-To: <20220505213438.25064-2-alex.sierra@amd.com>
Alex Sierra <alex.sierra@amd.com> writes:
[...]
> diff --git a/mm/rmap.c b/mm/rmap.c
> index fedb82371efe..d57102cd4b43 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1995,7 +1995,8 @@ void try_to_migrate(struct folio *folio, enum ttu_flags flags)
> TTU_SYNC)))
> return;
>
> - if (folio_is_zone_device(folio) && !folio_is_device_private(folio))
> + if (folio_is_zone_device(folio) &&
> + (!folio_is_device_private(folio) && !folio_is_device_coherent(folio)))
> return;
>
> /*
I vaguely recall commenting on this previously, or at least intending
to. In try_to_migrate_one() we have this:
if (folio_is_zone_device(folio)) {
unsigned long pfn = folio_pfn(folio);
swp_entry_t entry;
pte_t swp_pte;
/*
* Store the pfn of the page in a special migration
* pte. do_swap_page() will wait until the migration
* pte is removed and then restart fault handling.
*/
entry = pte_to_swp_entry(pteval);
if (is_writable_device_private_entry(entry))
entry = make_writable_migration_entry(pfn);
else
entry = make_readable_migration_entry(pfn);
swp_pte = swp_entry_to_pte(entry);
The check in try_to_migrate() guarantees that if folio_is_zone_device()
is true this must be a DEVICE_PRIVATE page and it treats it as such by
assuming there is a special device private swap entry there.
Relying on that assumption seems bad, and I have no idea why I didn't
just use is_device_private_page() originally but I think the fix is just
to change this to:
if (folio_is_device_private(folio))
And let DEVICE_COHERENT pages fall through to normal page processing.
- Alistair
next prev parent reply other threads:[~2022-05-12 3:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 21:34 [PATCH v1 00/15] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping Alex Sierra
2022-05-05 21:34 ` [PATCH v1 01/15] mm: add zone device coherent type memory support Alex Sierra
2022-05-12 2:58 ` Alistair Popple [this message]
2022-05-12 18:45 ` Sierra Guiza, Alejandro (Alex)
2022-05-05 21:34 ` [PATCH v1 02/15] mm: add device coherent vma selection for memory migration Alex Sierra
2022-05-05 21:34 ` [PATCH v1 03/15] mm: remove the vma check in migrate_vma_setup() Alex Sierra
2022-05-05 21:34 ` [PATCH v1 04/15] mm: add device coherent checker to remove migration pte Alex Sierra
2022-05-05 21:38 ` Sierra Guiza, Alejandro (Alex)
2022-05-05 22:48 ` Alistair Popple
2022-05-12 2:39 ` Alistair Popple
2022-05-05 21:34 ` [PATCH v1 05/15] mm/gup: migrate device coherent pages when pinning instead of failing Alex Sierra
2022-05-05 21:34 ` [PATCH v1 06/15] drm/amdkfd: add SPM support for SVM Alex Sierra
2022-05-05 21:34 ` [PATCH v1 07/15] drm/amdkfd: coherent type as sys mem on migration to ram Alex Sierra
2022-05-05 21:34 ` [PATCH v1 08/15] lib: test_hmm add ioctl to get zone device type Alex Sierra
2022-05-05 21:34 ` [PATCH v1 09/15] lib: test_hmm add module param for " Alex Sierra
2022-05-05 21:34 ` [PATCH v1 10/15] lib: add support for device coherent type in test_hmm Alex Sierra
2022-05-05 21:34 ` [PATCH v1 11/15] tools: update hmm-test to support device coherent type Alex Sierra
2022-05-05 21:34 ` [PATCH v1 12/15] tools: update test_hmm script to support SP config Alex Sierra
2022-05-05 21:34 ` [PATCH v1 13/15] mm: handling Non-LRU pages returned by vm_normal_pages Alex Sierra
2022-05-11 18:50 ` Jason Gunthorpe
2022-05-12 22:33 ` Sierra Guiza, Alejandro (Alex)
2022-05-13 11:45 ` Jason Gunthorpe
2022-05-05 21:34 ` [PATCH v1 14/15] tools: add hmm gup tests for device coherent type Alex Sierra
2022-05-16 8:02 ` Alistair Popple
2022-05-05 21:34 ` [PATCH v1 15/15] tools: add selftests to hmm for COW in device memory Alex Sierra
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=87bkw3qwc8.fsf@nvdebian.thelocal \
--to=apopple@nvidia.com \
--cc=Felix.Kuehling@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alex.sierra@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=david@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--cc=jgg@nvidia.com \
--cc=jglisse@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=rcampbell@nvidia.com \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).