]> git.baikalelectronics.ru Git - kernel.git/commit
x86: optimize lock prefix switching to run less frequently
authorAndi Kleen <ak@suse.de>
Wed, 30 Jan 2008 12:33:17 +0000 (13:33 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:33:17 +0000 (13:33 +0100)
commit805d9c1fd4d1eaef46684521a83ce0783b7e5a67
treea5e84b251b1574b09288fb2636b4e4ea088ae70e
parent3a19a69909e7144d9cf6ccfbd5ab7dcefa98d76b
x86: optimize lock prefix switching to run less frequently

On VMs implemented using JITs that cache translated code changing the lock
prefixes is a quite costly operation that forces the JIT to throw away and
retranslate a lot of code.

Previously a SMP kernel would rewrite the locks once for each CPU which
is quite unnecessary. This patch changes the code to never switch at boot in
 the normal case (SMP kernel booting with >1 CPU) or only once for SMP kernel
on UP.

This makes a significant difference in boot up performance on AMD SimNow!
Also I expect it to be a little faster on native systems too because a smp
switch does a lot of text_poke()s which each synchronize the pipeline.

v1->v2: Rename max_cpus
v1->v2: Fix off by one in UP check (Thomas Gleixner)

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/alternative.c
include/linux/smp.h
init/main.c