linux/kernel/sched
Peter Zijlstra 5fbd036b55 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>
2012-03-12 20:43:15 +01:00
..
Makefile sched: Move all scheduler bits into kernel/sched/ 2011-11-17 12:20:22 +01:00
auto_group.c sched: Clean up parameter passing of proc_sched_autogroup_set_nice() 2012-03-02 12:23:49 +01:00
auto_group.h sched: Move all scheduler bits into kernel/sched/ 2011-11-17 12:20:22 +01:00
clock.c sched: Move all scheduler bits into kernel/sched/ 2011-11-17 12:20:22 +01:00
core.c sched: Cleanup cpu_active madness 2012-03-12 20:43:15 +01:00
cpupri.c kernel-doc: fix kernel-doc warnings in sched 2012-01-23 08:44:54 -08:00
cpupri.h sched: Move all scheduler bits into kernel/sched/ 2011-11-17 12:20:22 +01:00
debug.c sched: Remove sched_switch 2012-01-27 13:28:53 +01:00
fair.c sched: Fix load-balance wreckage 2012-03-12 20:43:15 +01:00
features.h sched: Use jump_labels for sched_feat 2011-12-06 20:51:26 +01:00
idle_task.c sched: Move all scheduler bits into kernel/sched/ 2011-11-17 12:20:22 +01:00
rt.c sched/rt: Do not throttle when PI boosting 2012-03-01 10:28:02 +01:00
sched.h sched: Ditch per cgroup task lists for load-balancing 2012-03-01 13:08:37 +01:00
stats.c sched: Remove sched_switch 2012-01-27 13:28:53 +01:00
stats.h Merge branch 'sched/core' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into cputime-tip 2011-12-19 19:23:15 +01:00
stop_task.c sched: Move all scheduler bits into kernel/sched/ 2011-11-17 12:20:22 +01:00