]> git.karo-electronics.de Git - karo-tx-linux.git/commit
sched: Cleanup cpu_active madness
authorPeter Zijlstra <peterz@infradead.org>
Thu, 15 Dec 2011 16:09:22 +0000 (17:09 +0100)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:11:45 +0000 (14:11 +0200)
commitadedf460d58477de2e0047dee4418de3b30a0c86
tree0525fbda42684255c13d74677ba3d42d0c588993
parent440c2136c48c922c502cb77e20f8d4f12fc097c7
sched: Cleanup cpu_active madness

Stepan found:

CPU0 CPUn

_cpu_up()
  __cpu_up()

boostrap()
  notify_cpu_starting()
  set_cpu_online()
  while (!cpu_active())
    cpu_relax()

<PREEMPT-out>

smp_call_function(.wait=1)
  /* we find cpu_online() is true */
  arch_send_call_function_ipi_mask()

  /* wait-forever-more */

<PREEMPT-in>
  local_irq_enable()

  cpu_notify(CPU_ONLINE)
    sched_cpu_active()
      set_cpu_active()

Now the purpose of cpu_active is mostly with bringing down a cpu, where
we mark it !active to avoid the load-balancer from moving tasks to it
while we tear down the cpu. This is required because we only update the
sched_domain tree after we brought the cpu-down. And this is needed so
that some tasks can still run while we bring it down, we just don't want
new tasks to appear.

On cpu-up however the sched_domain tree doesn't yet include the new cpu,
so its invisible to the load-balancer, regardless of the active state.
So instead of setting the active state after we boot the new cpu (and
consequently having to wait for it before enabling interrupts) set the
cpu active before we set it online and avoid the whole mess.

Reported-by: Stepan Moskovchenko <stepanm@codeaurora.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1323965362.18942.71.camel@twins
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/arm/kernel/smp.c
kernel/sched.c