kernel_optimize_test/arch
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
..
alpha Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci 2012-01-11 18:50:26 -08:00
arm sched: Cleanup cpu_active madness 2012-03-12 20:43:15 +01:00
avr32 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
blackfin sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
c6x Kbuild: Use dtc's -d (dependency) option 2012-02-14 21:14:44 -05:00
cris sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
frv sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
h8300 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
hexagon sched: Cleanup cpu_active madness 2012-03-12 20:43:15 +01:00
ia64 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
m32r sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
m68k sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
microblaze sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
mips sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
mn10300 sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
openrisc Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2012-01-16 14:34:54 -08:00
parisc sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
powerpc sched/rt: Document scheduler related skip-resched-check sites 2012-03-01 10:28:04 +01:00
s390 sched: Cleanup cpu_active madness 2012-03-12 20:43:15 +01:00
score sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
sh sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
sparc sched/rt: Document scheduler related skip-resched-check sites 2012-03-01 10:28:04 +01:00
tile sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
um Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/audit 2012-01-17 16:41:31 -08:00
unicore32 Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci 2012-01-11 18:50:26 -08:00
x86 sched: Cleanup cpu_active madness 2012-03-12 20:43:15 +01:00
xtensa sched/rt: Use schedule_preempt_disabled() 2012-03-01 10:28:03 +01:00
.gitignore
Kconfig mm,x86,um: move CMPXCHG_DOUBLE config option 2012-01-12 20:13:03 -08:00