[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210209010722.13839-2-apopple@nvidia.com>
Date: Tue, 9 Feb 2021 12:07:14 +1100
From: Alistair Popple <apopple@...dia.com>
To: <linux-mm@...ck.org>, <nouveau@...ts.freedesktop.org>,
<bskeggs@...hat.com>, <akpm@...ux-foundation.org>
CC: <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<kvm-ppc@...r.kernel.org>, <dri-devel@...ts.freedesktop.org>,
<jhubbard@...dia.com>, <rcampbell@...dia.com>,
<jglisse@...hat.com>, "Alistair Popple" <apopple@...dia.com>
Subject: [PATCH 1/9] mm/migrate.c: Always allow device private pages to migrate
Device private pages are used to represent device memory that is not
directly accessible from the CPU. Extra references to a device private
page are only used to ensure the struct page itself remains valid whilst
waiting for migration entries. Therefore extra references should not
prevent device private page migration as this can lead to failures to
migrate pages back to the CPU which are fatal to the user process.
Signed-off-by: Alistair Popple <apopple@...dia.com>
---
mm/migrate.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 20ca887ea769..053228559fd3 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -405,8 +405,13 @@ int migrate_page_move_mapping(struct address_space *mapping,
int nr = thp_nr_pages(page);
if (!mapping) {
- /* Anonymous page without mapping */
- if (page_count(page) != expected_count)
+ /*
+ * Anonymous page without mapping. Device private pages should
+ * never have extra references except during migration, but it
+ * is safe to ignore these.
+ */
+ if (!is_device_private_page(page) &&
+ page_count(page) != expected_count)
return -EAGAIN;
/* No turning back from here */
--
2.20.1
Powered by blists - more mailing lists