From: David Hildenbrand <david@redhat.com>
To: Alex Sierra <alex.sierra@amd.com>, jgg@nvidia.com
Cc: 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 v5 02/13] mm: handling Non-LRU pages returned by vm_normal_pages
Date: Fri, 17 Jun 2022 11:51:34 +0200 [thread overview]
Message-ID: <ae6c6566-4c9b-0547-c2e4-3df7cb2bed33@redhat.com> (raw)
In-Reply-To: <20220531200041.24904-3-alex.sierra@amd.com>
On 31.05.22 22:00, Alex Sierra wrote:
> With DEVICE_COHERENT, we'll soon have vm_normal_pages() return
> device-managed anonymous pages that are not LRU pages. Although they
> behave like normal pages for purposes of mapping in CPU page, and for
> COW. They do not support LRU lists, NUMA migration or THP.
>
> We also introduced a FOLL_LRU flag that adds the same behaviour to
> follow_page and related APIs, to allow callers to specify that they
> expect to put pages on an LRU list.
>
> Signed-off-by: Alex Sierra <alex.sierra@amd.com>
> Acked-by: Felix Kuehling <Felix.Kuehling@amd.com>
> ---
> fs/proc/task_mmu.c | 2 +-
> include/linux/mm.h | 3 ++-
> mm/gup.c | 6 +++++-
> mm/huge_memory.c | 2 +-
> mm/khugepaged.c | 9 ++++++---
> mm/ksm.c | 6 +++---
> mm/madvise.c | 4 ++--
> mm/memory.c | 9 ++++++++-
> mm/mempolicy.c | 2 +-
> mm/migrate.c | 4 ++--
> mm/mlock.c | 2 +-
> mm/mprotect.c | 2 +-
> 12 files changed, 33 insertions(+), 18 deletions(-)
>
> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
> index 2d04e3470d4c..2dd8c8a66924 100644
> --- a/fs/proc/task_mmu.c
> +++ b/fs/proc/task_mmu.c
> @@ -1792,7 +1792,7 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma,
> return NULL;
>
> page = vm_normal_page(vma, addr, pte);
> - if (!page)
> + if (!page || is_zone_device_page(page))
> return NULL;
>
> if (PageReserved(page))
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index bc8f326be0ce..d3f43908ff8d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -601,7 +601,7 @@ struct vm_operations_struct {
> #endif
> /*
> * Called by vm_normal_page() for special PTEs to find the
> - * page for @addr. This is useful if the default behavior
> + * page for @addr. This is useful if the default behavior
> * (using pte_page()) would not find the correct page.
> */
> struct page *(*find_special_page)(struct vm_area_struct *vma,
> @@ -2934,6 +2934,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
> #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */
> #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */
> #define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
> +#define FOLL_LRU 0x1000 /* return only LRU (anon or page cache) */
Does that statement hold for special pages like the shared zeropage?
Also, this flag is only valid for in-kernel follow_page() but not for
the ordinary GUP interfaces. What are the semantics there? Is it fenced?
I really wonder if you should simply similarly teach the handful of
users of follow_page() to just special case these pages ... sounds
cleaner to me then adding flags with unclear semantics. Alternatively,
properly document what that flag is actually doing and where it applies.
I know, there was discussion on ... sorry for jumping in now, but this
doesn't look clean to me yet.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-06-17 9:51 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-31 20:00 [PATCH v5 00/13] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping Alex Sierra
2022-05-31 20:00 ` [PATCH v5 01/13] mm: add zone device coherent type memory support Alex Sierra
2022-06-17 9:40 ` David Hildenbrand
2022-06-17 17:20 ` Sierra Guiza, Alejandro (Alex)
2022-06-17 17:33 ` David Hildenbrand
2022-06-17 19:27 ` Sierra Guiza, Alejandro (Alex)
2022-06-17 21:19 ` David Hildenbrand
2022-06-21 11:25 ` Felix Kuehling
2022-06-21 11:32 ` David Hildenbrand
2022-06-21 11:55 ` Alistair Popple
2022-06-21 12:25 ` David Hildenbrand
2022-06-21 16:08 ` Sierra Guiza, Alejandro (Alex)
2022-06-21 16:16 ` David Hildenbrand
2022-06-22 0:16 ` Alistair Popple
2022-06-22 23:06 ` Sierra Guiza, Alejandro (Alex)
2022-06-22 23:16 ` Sierra Guiza, Alejandro (Alex)
2022-06-23 7:57 ` David Hildenbrand
2022-06-23 18:20 ` Sierra Guiza, Alejandro (Alex)
2022-06-23 18:21 ` David Hildenbrand
2022-06-24 16:13 ` Sierra Guiza, Alejandro (Alex)
2022-06-18 9:32 ` Oded Gabbay
2022-06-20 0:17 ` Alistair Popple
2022-06-20 6:01 ` Oded Gabbay
2022-06-20 8:13 ` Alistair Popple
2022-06-20 12:23 ` Oded Gabbay
2022-05-31 20:00 ` [PATCH v5 02/13] mm: handling Non-LRU pages returned by vm_normal_pages Alex Sierra
2022-06-08 7:06 ` Alistair Popple
2022-06-17 9:51 ` David Hildenbrand [this message]
2022-05-31 20:00 ` [PATCH v5 03/13] mm: add device coherent vma selection for memory migration Alex Sierra
2022-05-31 20:00 ` [PATCH v5 04/13] mm: remove the vma check in migrate_vma_setup() Alex Sierra
2022-05-31 20:00 ` [PATCH v5 05/13] mm/gup: migrate device coherent pages when pinning instead of failing Alex Sierra
2022-05-31 20:00 ` [PATCH v5 06/13] drm/amdkfd: add SPM support for SVM Alex Sierra
2022-05-31 20:00 ` [PATCH v5 07/13] lib: test_hmm add ioctl to get zone device type Alex Sierra
2022-05-31 20:00 ` [PATCH v5 08/13] lib: test_hmm add module param for " Alex Sierra
2022-05-31 20:00 ` [PATCH v5 09/13] lib: add support for device coherent type in test_hmm Alex Sierra
2022-05-31 20:00 ` [PATCH v5 10/13] tools: update hmm-test to support device coherent type Alex Sierra
2022-05-31 20:00 ` [PATCH v5 11/13] tools: update test_hmm script to support SP config Alex Sierra
2022-05-31 20:00 ` [PATCH v5 12/13] tools: add hmm gup tests for device coherent type Alex Sierra
2022-05-31 20:00 ` [PATCH v5 13/13] tools: add selftests to hmm for COW in device memory Alex Sierra
2022-06-17 2:19 ` [PATCH v5 00/13] Add MEMORY_DEVICE_COHERENT for coherent device memory mapping Andrew Morton
2022-06-17 7:44 ` David Hildenbrand
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=ae6c6566-4c9b-0547-c2e4-3df7cb2bed33@redhat.com \
--to=david@redhat.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=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).