Skip to contentSkip to conversation

AutoPage Migration - V0.1 - 8/8 hook automigration to migrate-on-fault

PATCH/RFC Lee Schermerhorn 1 participant 1 message Mar 10, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

AutoPage Migration - V0.1 - 8/8 hook automigration to migrate-on-fault

N.B., this patch depends on the "migrate-on-fault" patch series.

Add a /sys/kernel/migration control--sched_migrate_lazy--to use migrate-on-fault when sched_migrate_memory enabled.

Modify migrate_vma_to_node() to just unmap the eligible pages via migrate_pages_unmap_only() when sched_migrate_lazy enabled.

mm/mempolicy.c +38 -2
Index: linux-2.6.16-rc5-git11/mm/mempolicy.c
===================================================================
@@ -187,6 +187,37 @@ static ssize_t sched_migrate_interval_st
 }
 MIGRATION_ATTR_RW(sched_migrate_interval);
 
+/*
+ * sched_migrate_lazy:  use "lazy migration"--i.e., migration-on-fault--
+ * for scheduler driven task memory migration.
+ */
+int sched_migrate_lazy = 0;
+
+static int __init set_sched_migrate_lazy(char *str)
+{
+	get_option(&str, &sched_migrate_lazy);
+	return 1;
+}
+
+__setup("sched_migrate_lazy", set_sched_migrate_lazy);
+
+static ssize_t sched_migrate_lazy_show(struct subsystem *subsys, char *page)
+{
+	return sprintf(page, "sched_migrate_lazy %s\n",
+			sched_migrate_lazy ? "on" : "off");
+}
+static ssize_t sched_migrate_lazy_store(struct subsystem *subsys,
+				      const char *page, size_t count)
+{
+        unsigned long n = simple_strtoul(page, NULL, 10);
+	if (n)
+		sched_migrate_lazy = 1;
+	else
+		sched_migrate_lazy = 0;
+        return count;
+}
+MIGRATION_ATTR_RW(sched_migrate_lazy);
+
 
 decl_subsys(migration, NULL, NULL);
 EXPORT_SYMBOL(migration_subsys);
@@ -194,6 +225,7 @@ EXPORT_SYMBOL(migration_subsys);
 static struct attribute *migration_attrs[] = {
 	&sched_migrate_memory_attr.attr,
 	&sched_migrate_interval_attr.attr,
+	&sched_migrate_lazy_attr.attr,
 	NULL
 };
 
@@ -882,8 +914,12 @@ static int migrate_vma_to_node(struct vm
 
 	if (IS_ERR(vma))
 		err = PTR_ERR(vma);
-	else if (!list_empty(&pagelist))
-		err = migrate_pages_to(&pagelist, NULL, dest);
+	else if (!list_empty(&pagelist)) {
+		if (!sched_migrate_lazy)
+			err = migrate_pages_to(&pagelist, NULL, dest);
+		else
+			err = migrate_pages_unmap_only(&pagelist);
+	}
 
 	if (!list_empty(&pagelist))
 		putback_lru_pages(&pagelist);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>