linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Popple <apopple@nvidia.com>
To: linux-mm@kvack.org
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alistair Popple <apopple@nvidia.com>
Subject: [PATCH RFC 0/6] Allow file-backed or shared device private pages
Date: Sun, 16 Mar 2025 15:29:23 +1100	[thread overview]
Message-ID: <cover.24b48fced909fe1414e83b58aa468d4393dd06de.1742099301.git-series.apopple@nvidia.com> (raw)

To simplify the initial implementation device private pages were restricted to
only being used for private anonymous. This avoided having to deal with issues
related to shared and/or file-backed pagesi early on.

This series lifts that restriction by allowing ZONE_DEVICE private pages to
exist in the pagecache. As the CPU cannot directly access these pages special
care needs to be taken when looking them up in the page-cache. This series
solves the problem by always migrating such pages back from device memory when
looking them up in the pagecache. This is similar to how device private pages
work for anonymous memory, where a CPU fault on the device memory will always
trigger a migration back to CPU system memory.

Initially this series only allows for read-only migration - this is because the
call to migrate pages back will always reload the data from backing storage.
It then introduces a callback that drivers may implement to actually copy any
modified data back as required.

Drivers are expected to call set_page_dirty() when copying data back to ensure
it hits the backing store.

This series is an early draft implementation - in particular error handling
is not dealt with and I'm not sure that the management of PTE write bits is
entirely correct. Much more testing of all the various filesystem corner cases
is also required. The aim of this series is to get early feedback on the overall
concept of putting device private pages in the pagecache before fleshing out the
implementation further.

Signed-off-by: Alistair Popple <apopple@nvidia.com>

Alistair Popple (6):
  mm/migrate_device.c: Don't read dirty bit of non-present PTEs
  mm/migrate: Support file-backed pages with migrate_vma
  mm: Allow device private pages to exist in page cache
  mm: Implement writeback for share device private pages
  selftests/hmm: Add file-backed migration tests
  nouveau: Add SVM support for migrating file-backed pages to the GPU

 drivers/gpu/drm/nouveau/nouveau_dmem.c |  24 ++-
 include/linux/memremap.h               |   2 +-
 include/linux/migrate.h                |   6 +-
 lib/test_hmm.c                         |  27 ++-
 mm/filemap.c                           |  41 ++++-
 mm/memory.c                            |   9 +-
 mm/memremap.c                          |   1 +-
 mm/migrate.c                           |  42 ++--
 mm/migrate_device.c                    | 114 +++++++++++-
 mm/rmap.c                              |   2 +-
 tools/testing/selftests/mm/hmm-tests.c | 252 +++++++++++++++++++++++++-
 11 files changed, 489 insertions(+), 31 deletions(-)

base-commit: 0ad2507d5d93f39619fc42372c347d6006b64319
-- 
git-series 0.9.1


             reply	other threads:[~2025-03-16  4:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-16  4:29 Alistair Popple [this message]
2025-03-16  4:29 ` [PATCH RFC 1/6] mm/migrate_device.c: Don't read dirty bit of non-present PTEs Alistair Popple
2025-03-16  4:29 ` [PATCH RFC 2/6] mm/migrate: Support file-backed pages with migrate_vma Alistair Popple
2025-03-16  4:29 ` [PATCH RFC 3/6] mm: Allow device private pages to exist in page cache Alistair Popple
2025-03-16  4:29 ` [PATCH RFC 4/6] mm: Implement writeback for share device private pages Alistair Popple
2025-03-16  4:29 ` [PATCH RFC 5/6] selftests/hmm: Add file-backed migration tests Alistair Popple
2025-03-16  4:29 ` [PATCH RFC 6/6] nouveau: Add SVM support for migrating file-backed pages to the GPU Alistair Popple
2025-03-17  6:04 ` [PATCH RFC 0/6] Allow file-backed or shared device private pages Christoph Hellwig
2025-03-26  2:14   ` Matthew Wilcox
2025-03-27 14:49     ` Alistair Popple
2025-03-27 16:47       ` Matthew Wilcox
2025-04-07  9:15     ` 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=cover.24b48fced909fe1414e83b58aa468d4393dd06de.1742099301.git-series.apopple@nvidia.com \
    --to=apopple@nvidia.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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