sched/numa: Reschedule task on preferred NUMA node once selected
[deliverable/linux.git] / kernel / sched / core.c
index b7e6b6f9c5f6b888c93e38f735c969ae6d7ead19..66b878e945548d1415e545489efcb603f6d389e1 100644 (file)
@@ -4348,6 +4348,25 @@ fail:
        return ret;
 }
 
+#ifdef CONFIG_NUMA_BALANCING
+/* Migrate current task p to target_cpu */
+int migrate_task_to(struct task_struct *p, int target_cpu)
+{
+       struct migration_arg arg = { p, target_cpu };
+       int curr_cpu = task_cpu(p);
+
+       if (curr_cpu == target_cpu)
+               return 0;
+
+       if (!cpumask_test_cpu(target_cpu, tsk_cpus_allowed(p)))
+               return -EINVAL;
+
+       /* TODO: This is not properly updating schedstats */
+
+       return stop_one_cpu(curr_cpu, migration_cpu_stop, &arg);
+}
+#endif
+
 /*
  * migration_cpu_stop - this will be executed by a highprio stopper thread
  * and performs thread migration by bumping thread off CPU then
This page took 0.036117 seconds and 5 git commands to generate.