summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-10-09 12:36:29 -0400
committerIngo Molnar <mingo@kernel.org>2015-10-20 04:25:56 -0400
commit62694cd51322262a9142e946915fc4783113ccff (patch)
treeafcbbd408026ef603f6831fce8867b73601d77ec
parent07f06cb3b5f6bd21374a48dbefdb431d71d53974 (diff)
sched: Move cpu_active() tests from stop_two_cpus() into migrate_swap_stop()
The cpu_active() tests are not fundamentally part of stop_two_cpus(), move then into the scheduler where they belong. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--kernel/sched/core.c4
-rw-r--r--kernel/stop_machine.c9
2 files changed, 4 insertions, 9 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7ee8caea1195..a7b368e51f69 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1335,12 +1335,16 @@ static int migrate_swap_stop(void *data)
1335 struct rq *src_rq, *dst_rq; 1335 struct rq *src_rq, *dst_rq;
1336 int ret = -EAGAIN; 1336 int ret = -EAGAIN;
1337 1337
1338 if (!cpu_active(arg->src_cpu) || !cpu_active(arg->dst_cpu))
1339 return -EAGAIN;
1340
1338 src_rq = cpu_rq(arg->src_cpu); 1341 src_rq = cpu_rq(arg->src_cpu);
1339 dst_rq = cpu_rq(arg->dst_cpu); 1342 dst_rq = cpu_rq(arg->dst_cpu);
1340 1343
1341 double_raw_lock(&arg->src_task->pi_lock, 1344 double_raw_lock(&arg->src_task->pi_lock,
1342 &arg->dst_task->pi_lock); 1345 &arg->dst_task->pi_lock);
1343 double_rq_lock(src_rq, dst_rq); 1346 double_rq_lock(src_rq, dst_rq);
1347
1344 if (task_cpu(arg->dst_task) != arg->dst_cpu) 1348 if (task_cpu(arg->dst_task) != arg->dst_cpu)
1345 goto unlock; 1349 goto unlock;
1346 1350
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index e5a09d2dc575..867bc20e1ef1 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -275,15 +275,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
275 cpu_stop_init_done(&done, 2); 275 cpu_stop_init_done(&done, 2);
276 set_state(&msdata, MULTI_STOP_PREPARE); 276 set_state(&msdata, MULTI_STOP_PREPARE);
277 277
278 /*
279 * We do not want to migrate to inactive CPU. FIXME: move this
280 * into migrate_swap_stop() callback.
281 */
282 if (!cpu_active(cpu1) || !cpu_active(cpu2)) {
283 preempt_enable();
284 return -ENOENT;
285 }
286
287 if (cpu1 > cpu2) 278 if (cpu1 > cpu2)
288 swap(cpu1, cpu2); 279 swap(cpu1, cpu2);
289 if (cpu_stop_queue_two_works(cpu1, &work1, cpu2, &work2)) { 280 if (cpu_stop_queue_two_works(cpu1, &work1, cpu2, &work2)) {