From: Zwane Mwaikambo Pulled from the -tiny tree, the focus of this patch is for reduced kernel image size but in the process we benefit from improved cache performance since it's possible for the common text to be present in cache. This is probably more of a win on shared cache multiprocessor systems like P4/Xeon HT. It's been benchmarked with bonnie++ on 2x and 4x PIII (my ideal target would be a 4x+ logical cpu Xeon). Changes have been made based on feedback from various people, most notably profiling support for readprofile and oprofile. Changes from the last release include using fastcall and normal C functions for the out of line spinlock code. There was an additional suggestion by Linus to move the preempt code out of line too but i think that may be too invasive for this first step. Results from a dbench run on 2, 4 and 8x systems are available at http://www.zwane.ca/cool-locks-stp but based on those results there is no observable performance regression. Size differences on x86_64: text data bss dec hex filename 4864192 1452156 523632 6839980 685eac vmlinux-after 4881677 1449436 523632 6854745 689859 vmlinux-before Size differences on i386: text data bss dec hex filename 6287428 868142 326864 7482434 722c42 vmlinux-after 6321421 871138 326864 7519423 72bcbf vmlinux-before Signed-off-by: Zwane Mwaikambo Signed-off-by: Andrew Morton --- 25-akpm/drivers/oprofile/timer_int.c | 2 +- 25-akpm/include/asm-generic/vmlinux.lds.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff -puN drivers/oprofile/timer_int.c~completely-out-of-line-spinlocks--generic drivers/oprofile/timer_int.c --- 25/drivers/oprofile/timer_int.c~completely-out-of-line-spinlocks--generic 2004-08-30 00:19:29.033113680 -0700 +++ 25-akpm/drivers/oprofile/timer_int.c 2004-08-30 00:19:29.043112160 -0700 @@ -19,7 +19,7 @@ static int timer_notify(struct notifier_ { struct pt_regs * regs = (struct pt_regs *)data; int cpu = smp_processor_id(); - unsigned long eip = instruction_pointer(regs); + unsigned long eip = profile_pc(regs); oprofile_add_sample(eip, !user_mode(regs), 0, cpu); return 0; diff -puN include/asm-generic/vmlinux.lds.h~completely-out-of-line-spinlocks--generic include/asm-generic/vmlinux.lds.h --- 25/include/asm-generic/vmlinux.lds.h~completely-out-of-line-spinlocks--generic 2004-08-30 00:19:29.039112768 -0700 +++ 25-akpm/include/asm-generic/vmlinux.lds.h 2004-08-30 00:19:29.043112160 -0700 @@ -80,3 +80,8 @@ VMLINUX_SYMBOL(__sched_text_start) = .; \ *(.sched.text) \ VMLINUX_SYMBOL(__sched_text_end) = .; + +#define SPINLOCK_TEXT \ + VMLINUX_SYMBOL(__spinlock_text_start) = .; \ + *(.spinlock.text) \ + VMLINUX_SYMBOL(__spinlock_text_end) = .; _