]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - mm/migrate.c
[PATCH] page migration: Support a vma migration function
[mirror_ubuntu-jammy-kernel.git] / mm / migrate.c
index 1c2a71aa05cd425a2863a1abc20f1ea6f7636085..0576c053598803303beb6c0244ad06dffdef0f69 100644 (file)
@@ -976,3 +976,23 @@ out2:
 }
 #endif
 
+/*
+ * Call migration functions in the vma_ops that may prepare
+ * memory in a vm for migration. migration functions may perform
+ * the migration for vmas that do not have an underlying page struct.
+ */
+int migrate_vmas(struct mm_struct *mm, const nodemask_t *to,
+       const nodemask_t *from, unsigned long flags)
+{
+       struct vm_area_struct *vma;
+       int err = 0;
+
+       for(vma = mm->mmap; vma->vm_next && !err; vma = vma->vm_next) {
+               if (vma->vm_ops && vma->vm_ops->migrate) {
+                       err = vma->vm_ops->migrate(vma, to, from, flags);
+                       if (err)
+                               break;
+               }
+       }
+       return err;
+}