From: Jason Gunthorpe <jgg@nvidia.com>
To: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@amd.com>
Cc: david@redhat.com, Felix.Kuehling@amd.com, linux-mm@kvack.org,
rcampbell@nvidia.com, linux-ext4@vger.kernel.org,
linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org, hch@lst.de, jglisse@redhat.com,
apopple@nvidia.com, willy@infradead.org,
akpm@linux-foundation.org
Subject: Re: [PATCH v1 13/15] mm: handling Non-LRU pages returned by vm_normal_pages
Date: Fri, 13 May 2022 08:45:53 -0300 [thread overview]
Message-ID: <20220513114553.GK1343366@nvidia.com> (raw)
In-Reply-To: <833a5eb1-f64c-0b1e-a318-051bde629ab2@amd.com>
On Thu, May 12, 2022 at 05:33:44PM -0500, Sierra Guiza, Alejandro (Alex) wrote:
>
> On 5/11/2022 1:50 PM, Jason Gunthorpe wrote:
> > On Thu, May 05, 2022 at 04:34:36PM -0500, Alex Sierra wrote:
> >
> > > diff --git a/mm/memory.c b/mm/memory.c
> > > index 76e3af9639d9..892c4cc54dc2 100644
> > > +++ b/mm/memory.c
> > > @@ -621,6 +621,13 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
> > > if (is_zero_pfn(pfn))
> > > return NULL;
> > > if (pte_devmap(pte))
> > > +/*
> > > + * NOTE: Technically this should goto check_pfn label. However, page->_mapcount
> > > + * is never incremented for device pages that are mmap through DAX mechanism
> > > + * using pmem driver mounted into ext4 filesystem. When these pages are unmap,
> > > + * zap_pte_range is called and vm_normal_page return a valid page with
> > > + * page_mapcount() = 0, before page_remove_rmap is called.
> > > + */
> > > return NULL;
> > ? Where does this series cause device coherent to be returned?
> In our case, device coherent pages could be obtained as a result of
> migration(Patches 6/7 of 15), ending up mapped in CPU page tables. Later on,
> these pages might need to be returned by get_user_pages or other callers
> through vm_normal_pages. Our approach in this series, is to handle
> device-coherent-managed pages returned by vm_normal_pages, inside each
> caller. EX. device coherent pages don’t support LRU lists, NUMA migration or
> THP.
> >
> > Wasn't the plan to not set pte_devmap() ?
>
> amdgpu does not set pte_devmap for our DEVICE_COHERENT pages. DEVMAP flags
> are set by drivers like virtio_fs or pmem, where MEMORY_DEVICE_FS_DAX type
> is used.
> This patch series deals with DEVICE_COHERENT pages. My understanding was,
> that the DAX code and DEVICE_GENERIC would be fixed up later by someone more
> familiar with it. Were you expecting that we'd fix the DAX usage of
> pte_devmap flags in this patch series as well?
No, I was just trying to find where the pages got inserted and
understand the comment above. I think the comment should be clarified
more like you explained:
New uers of ZONE_DEVICE will not set pte_devmap() and will have
refcounts incremented on their struct pages when they are inserted
into PTEs, thus they are safe to return here. Legacy ZONE_DEVICE
pages that set pte_devmap() do not have refcounts. ....
Jason
next prev parent reply other threads:[~2022-05-13 11:46 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
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 [this message]
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=20220513114553.GK1343366@nvidia.com \
--to=jgg@nvidia.com \
--cc=Felix.Kuehling@amd.com \
--cc=akpm@linux-foundation.org \
--cc=alex.sierra@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=apopple@nvidia.com \
--cc=david@redhat.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hch@lst.de \
--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).