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


Groups > linux.kernel > #1244178

Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active() like select_fallback_rq()

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active() like select_fallback_rq()
Date 2015-10-11 20:10 +0200
Message-ID <qitei-7DS-5@gated-at.bofh.it> (permalink)
References <qi7x8-15U-5@gated-at.bofh.it> <qi7x8-15U-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 10/10, Oleg Nesterov wrote:
>
> I do not understand the cpu_active() check in select_fallback_rq().
> x86 doesn't need it, and the recent commit dd9d3843755d "sched: Fix
> cpu_active_mask/cpu_online_mask race" documents the fact that on any
> architecture we can ignore !active starting from CPU_ONLINE stage.
>
> But any possible reason why do we need this check in "fallback" must
> equally apply to select_task_rq().

And I still think this is true, select_task_rq() and select_fallback_rq()
should use the same check in any case...

> +static inline bool cpu_allowed(int cpu)
> +{
> +	return cpu_online(cpu) && cpu_active(cpu);
> +}
...
> @@ -1390,7 +1391,7 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)
>  	 *   not worry about this generic constraint ]
>  	 */
>  	if (unlikely(!cpumask_test_cpu(cpu, tsk_cpus_allowed(p)) ||
> -		     !cpu_online(cpu)))
> +		     !cpu_allowed(cpu)))
>  		cpu = select_fallback_rq(task_cpu(p), p);

But as Fengguang reports (thanks a lot!) this change is wrong. It leads
to another BUG_ON(td->cpu != smp_processor_id()) before ht->park(td->cpu)
in smpboot_thread_fn().

I should have realized this. smpboot_park_threads() is called after
CPU_DOWN_PREPARE. And this can break other PF_NO_SETAFFINITY threads.

Perhaps I am totally confused, but to me this looks like another
indication that select_fallback_rq() should not check cpu_active(),
or at least this needs some changes...

Oleg.

--
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

[PATCH 1/3] sched: select_task_rq() should check cpu_active() like  select_fallback_rq() Oleg Nesterov <oleg@redhat.com> - 2015-10-10 21:00 +0200
  Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Oleg Nesterov <oleg@redhat.com> - 2015-10-11 20:10 +0200
    Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Thomas Gleixner <tglx@linutronix.de> - 2015-10-11 21:00 +0200
  Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Peter Zijlstra <peterz@infradead.org> - 2015-10-12 14:20 +0200
    Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Oleg Nesterov <oleg@redhat.com> - 2015-10-12 19:40 +0200
      Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Peter Zijlstra <peterz@infradead.org> - 2015-10-14 17:10 +0200
        Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Oleg Nesterov <oleg@redhat.com> - 2015-10-14 22:10 +0200
          Re: [PATCH 1/3] sched: select_task_rq() should check cpu_active()  like select_fallback_rq() Peter Zijlstra <peterz@infradead.org> - 2015-10-14 22:40 +0200

csiph-web