aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Hellwig <[email protected]>2022-02-16 15:31:37 +1100
committerMatthew Wilcox (Oracle) <[email protected]>2022-03-03 12:47:33 -0500
commit1776c0d102482d4aeccd56e404285bc47a481be8 (patch)
treeb39590a978d033b93811018e58d1b535c5574438
parentf9f38f78c5d5eef3717b48d84263b4b46ee0110a (diff)
mm: refactor the ZONE_DEVICE handling in migrate_vma_insert_page
Make the flow a little more clear and prepare for adding a new ZONE_DEVICE memory type. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Alistair Popple <[email protected]> Tested-by: "Sierra Guiza, Alejandro (Alex)" <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Ben Skeggs <[email protected]> Cc: Chaitanya Kulkarni <[email protected]> Cc: Christian Knig <[email protected]> Cc: Dan Williams <[email protected]> Cc: Felix Kuehling <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Karol Herbst <[email protected]> Cc: Logan Gunthorpe <[email protected]> Cc: Lyude Paul <[email protected]> Cc: Miaohe Lin <[email protected]> Cc: Muchun Song <[email protected]> Cc: "Pan, Xinhui" <[email protected]> Cc: Ralph Campbell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Matthew Wilcox (Oracle) <[email protected]>
-rw-r--r--mm/migrate.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/mm/migrate.c b/mm/migrate.c
index af0534de618a..4246dca6c469 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2674,26 +2674,25 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
*/
__SetPageUptodate(page);
- if (is_zone_device_page(page)) {
- if (is_device_private_page(page)) {
- swp_entry_t swp_entry;
+ if (is_device_private_page(page)) {
+ swp_entry_t swp_entry;
- if (vma->vm_flags & VM_WRITE)
- swp_entry = make_writable_device_private_entry(
- page_to_pfn(page));
- else
- swp_entry = make_readable_device_private_entry(
- page_to_pfn(page));
- entry = swp_entry_to_pte(swp_entry);
- } else {
- /*
- * For now we only support migrating to un-addressable
- * device memory.
- */
+ if (vma->vm_flags & VM_WRITE)
+ swp_entry = make_writable_device_private_entry(
+ page_to_pfn(page));
+ else
+ swp_entry = make_readable_device_private_entry(
+ page_to_pfn(page));
+ entry = swp_entry_to_pte(swp_entry);
+ } else {
+ /*
+ * For now we only support migrating to un-addressable device
+ * memory.
+ */
+ if (is_zone_device_page(page)) {
pr_warn_once("Unsupported ZONE_DEVICE page type.\n");
goto abort;
}
- } else {
entry = mk_pte(page, vma->vm_page_prot);
if (vma->vm_flags & VM_WRITE)
entry = pte_mkwrite(pte_mkdirty(entry));