From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756845AbbJIQhP (ORCPT ); Fri, 9 Oct 2015 12:37:15 -0400 Received: from casper.infradead.org ([85.118.1.10]:33156 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751526AbbJIQhN (ORCPT ); Fri, 9 Oct 2015 12:37:13 -0400 Date: Fri, 9 Oct 2015 18:37:10 +0200 From: Peter Zijlstra To: Oleg Nesterov Cc: heiko.carstens@de.ibm.com, Tejun Heo , Ingo Molnar , Rik van Riel , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/3] stop_machine: change cpu_stop_queue_two_works() to rely on stopper->enabled Message-ID: <20151009163710.GF3816@twins.programming.kicks-ass.net> References: <20151008145059.GA17916@redhat.com> <20151008145136.GA18149@redhat.com> <20151008170141.GA25537@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151008170141.GA25537@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2015 at 07:01:41PM +0200, Oleg Nesterov wrote: > @@ -261,12 +276,8 @@ int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void * > set_state(&msdata, MULTI_STOP_PREPARE); > > /* > - * If we observe both CPUs active we know _cpu_down() cannot yet have > - * queued its stop_machine works and therefore ours will get executed > - * first. Or its not either one of our CPUs that's getting unplugged, > - * in which case we don't care. > - * > - * This relies on the stopper workqueues to be FIFO. > + * We do not want to migrate to inactive CPU. FIXME: move this > + * into migrate_swap_stop() callback. > */ > if (!cpu_active(cpu1) || !cpu_active(cpu2)) { > preempt_enable(); I stuck that on top.. I'll have a closer look at the 7 patches later when I might be more coherent (mad head-ache atm.) --- --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1335,12 +1335,16 @@ static int migrate_swap_stop(void *data) struct rq *src_rq, *dst_rq; int ret = -EAGAIN; + if (!cpu_active(arg->src_cpu) || !cpu_active(arg->dst_cpu)) + return -EAGAIN; + src_rq = cpu_rq(arg->src_cpu); dst_rq = cpu_rq(arg->dst_cpu); double_raw_lock(&arg->src_task->pi_lock, &arg->dst_task->pi_lock); double_rq_lock(src_rq, dst_rq); + if (task_cpu(arg->dst_task) != arg->dst_cpu) goto unlock; --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c @@ -275,15 +275,6 @@ int stop_two_cpus(unsigned int cpu1, uns cpu_stop_init_done(&done, 2); set_state(&msdata, MULTI_STOP_PREPARE); - /* - * We do not want to migrate to inactive CPU. FIXME: move this - * into migrate_swap_stop() callback. - */ - if (!cpu_active(cpu1) || !cpu_active(cpu2)) { - preempt_enable(); - return -ENOENT; - } - if (cpu1 > cpu2) swap(cpu1, cpu2); if (cpu_stop_queue_two_works(cpu1, &work1, cpu2, &work2)) {