Skip to content

Commit 62694cd

Browse files
Peter Zijlstraingomolnar
authored andcommitted
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>
1 parent 07f06cb commit 62694cd

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

‎kernel/sched/core.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,12 +1335,16 @@ static int migrate_swap_stop(void *data)
13351335
struct rq *src_rq, *dst_rq;
13361336
int ret = -EAGAIN;
13371337

1338+
if (!cpu_active(arg->src_cpu) || !cpu_active(arg->dst_cpu))
1339+
return -EAGAIN;
1340+
13381341
src_rq = cpu_rq(arg->src_cpu);
13391342
dst_rq = cpu_rq(arg->dst_cpu);
13401343

13411344
double_raw_lock(&arg->src_task->pi_lock,
13421345
&arg->dst_task->pi_lock);
13431346
double_rq_lock(src_rq, dst_rq);
1347+
13441348
if (task_cpu(arg->dst_task) != arg->dst_cpu)
13451349
goto unlock;
13461350

‎kernel/stop_machine.c‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,15 +275,6 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *
275275
cpu_stop_init_done(&done, 2);
276276
set_state(&msdata, MULTI_STOP_PREPARE);
277277

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-
287278
if (cpu1 > cpu2)
288279
swap(cpu1, cpu2);
289280
if (cpu_stop_queue_two_works(cpu1, &work1, cpu2, &work2)) {

0 commit comments

Comments
 (0)