Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1243523

Re: [PATCH v2 3/3] stop_machine: change cpu_stop_queue_two_works() to rely on stopper->enabled

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/3] stop_machine: change cpu_stop_queue_two_works() to rely on stopper->enabled
Date 2015-10-09 18:40 +0200
Message-ID <qhIS7-7BS-39@gated-at.bofh.it> (permalink)
References <qhkPM-6FW-23@gated-at.bofh.it> <qhkPO-6FW-61@gated-at.bofh.it> <qhmRA-1ld-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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)) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH] sched: Start stopper early Peter Zijlstra <peterz@infradead.org> - 2015-10-07 10:50 +0200
  Re: [RFC][PATCH] sched: Start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-07 14:40 +0200
    Re: [RFC][PATCH] sched: Start stopper early Peter Zijlstra <peterz@infradead.org> - 2015-10-07 14:40 +0200
      Re: [RFC][PATCH] sched: Start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-07 15:30 +0200
        Re: [RFC][PATCH] sched: Start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-07 15:30 +0200
        Re: Re: [RFC][PATCH] sched: Start stopper early kbuild test robot <lkp@intel.com> - 2015-10-07 15:40 +0200
  [PATCH 0/3] (Was: [RFC][PATCH] sched: Start stopper early) Oleg Nesterov <oleg@redhat.com> - 2015-10-08 17:00 +0200
    [PATCH 1/3] stop_machine: ensure that a queued callback will be  called before cpu_stop_park() Oleg Nesterov <oleg@redhat.com> - 2015-10-08 17:00 +0200
      Re: [PATCH 1/3] stop_machine: ensure that a queued callback will be  called before cpu_stop_park() Peter Zijlstra <peterz@infradead.org> - 2015-10-14 17:40 +0200
        Re: [PATCH 1/3] stop_machine: ensure that a queued callback will  be called before cpu_stop_park() Oleg Nesterov <oleg@redhat.com> - 2015-10-14 21:10 +0200
          Re: [PATCH 1/3] stop_machine: ensure that a queued callback will be  called before cpu_stop_park() Peter Zijlstra <peterz@infradead.org> - 2015-10-14 22:40 +0200
            Re: [PATCH 1/3] stop_machine: ensure that a queued callback will  be called before cpu_stop_park() Oleg Nesterov <oleg@redhat.com> - 2015-10-15 19:10 +0200
              Re: [PATCH 1/3] stop_machine: ensure that a queued callback will be  called before cpu_stop_park() Peter Zijlstra <peterz@infradead.org> - 2015-10-16 13:00 +0200
    [PATCH 3/3] stop_machine: change cpu_stop_queue_two_works() to  rely on stopper->enabled Oleg Nesterov <oleg@redhat.com> - 2015-10-08 17:00 +0200
      Re: [PATCH 3/3] stop_machine: change cpu_stop_queue_two_works() to  rely on stopper->enabled Peter Zijlstra <peterz@infradead.org> - 2015-10-08 17:10 +0200
        Re: [PATCH 3/3] stop_machine: change cpu_stop_queue_two_works() to  rely on stopper->enabled Oleg Nesterov <oleg@redhat.com> - 2015-10-08 18:10 +0200
          Re: [PATCH 3/3] stop_machine: change cpu_stop_queue_two_works() to  rely on stopper->enabled Oleg Nesterov <oleg@redhat.com> - 2015-10-08 18:20 +0200
      [PATCH v2 3/3] stop_machine: change cpu_stop_queue_two_works() to  rely on stopper->enabled Oleg Nesterov <oleg@redhat.com> - 2015-10-08 19:10 +0200
        Re: [PATCH v2 3/3] stop_machine: change cpu_stop_queue_two_works()  to rely on stopper->enabled Peter Zijlstra <peterz@infradead.org> - 2015-10-09 18:40 +0200
          Re: [PATCH v2 3/3] stop_machine: change cpu_stop_queue_two_works()  to rely on stopper->enabled Oleg Nesterov <oleg@redhat.com> - 2015-10-09 18:50 +0200
    [PATCH 2/3] stop_machine: introduce __cpu_stop_queue_work() and  cpu_stop_queue_two_works() Oleg Nesterov <oleg@redhat.com> - 2015-10-08 17:00 +0200
  Re: [RFC][PATCH] sched: Start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-08 20:10 +0200
    Re: [RFC][PATCH] sched: Start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-08 21:00 +0200
  [PATCH 0/3] make stopper threads more "selfparking" Oleg Nesterov <oleg@redhat.com> - 2015-10-09 18:10 +0200
    [PATCH 2/3] stop_machine: kill cpu_stop_threads->setup() and  cpu_stop_unpark() Oleg Nesterov <oleg@redhat.com> - 2015-10-09 18:10 +0200
    [PATCH 3/3] sched: start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-09 18:10 +0200
      Re: [PATCH 3/3] sched: start stopper early Oleg Nesterov <oleg@redhat.com> - 2015-10-09 19:00 +0200
    [PATCH 1/3] stop_machine: kill smp_hotplug_thread->pre_unpark,  introduce stop_machine_unpark() Oleg Nesterov <oleg@redhat.com> - 2015-10-09 18:10 +0200
  Re: [RFC][PATCH] sched: Start stopper early Heiko Carstens <heiko.carstens@de.ibm.com> - 2015-10-16 10:30 +0200
    Re: [RFC][PATCH] sched: Start stopper early Peter Zijlstra <peterz@infradead.org> - 2015-10-16 12:00 +0200
      Re: [RFC][PATCH] sched: Start stopper early Heiko Carstens <heiko.carstens@de.ibm.com> - 2015-10-16 14:10 +0200

csiph-web