diff -ur linux-sched/include/asm-alpha/smp.h linux-2.3.40/include/asm-alpha/smp.h --- linux-sched/include/asm-alpha/smp.h Sat Jan 8 16:13:12 2000 +++ linux-2.3.40/include/asm-alpha/smp.h Sun Jan 23 19:39:30 2000 @@ -38,8 +38,6 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS]; -#define PROC_CHANGE_PENALTY 20 - /* Map from cpu id to sequential logical cpu number. This will only not be idempotent when cpus failed to come on-line. */ extern int cpu_number_map[NR_CPUS]; diff -ur linux-sched/include/asm-i386/smp.h linux-2.3.40/include/asm-i386/smp.h --- linux-sched/include/asm-i386/smp.h Sun Jan 23 17:44:30 2000 +++ linux-2.3.40/include/asm-i386/smp.h Sun Jan 23 19:48:30 2000 @@ -95,7 +95,5 @@ * processes are run. */ -#define PROC_CHANGE_PENALTY 15 /* Schedule penalty */ - #endif #endif diff -ur linux-sched/include/asm-ppc/smp.h linux-2.3.40/include/asm-ppc/smp.h --- linux-sched/include/asm-ppc/smp.h Mon Dec 20 17:27:34 1999 +++ linux-2.3.40/include/asm-ppc/smp.h Sun Jan 23 19:39:52 2000 @@ -29,7 +29,6 @@ void smp_send_tlb_invalidate(int); #define NO_PROC_ID 0xFF /* No processor magic marker */ -#define PROC_CHANGE_PENALTY 20 /* 1 to 1 mapping on PPC -- Cort */ #define cpu_logical_map(cpu) (cpu) diff -ur linux-sched/include/asm-sparc/smp.h linux-2.3.40/include/asm-sparc/smp.h --- linux-sched/include/asm-sparc/smp.h Sun Jan 23 04:34:05 2000 +++ linux-2.3.40/include/asm-sparc/smp.h Sun Jan 23 19:40:01 2000 @@ -181,8 +181,6 @@ #define MBOX_IDLECPU2 0xFD #define MBOX_STOPCPU2 0xFE -#define PROC_CHANGE_PENALTY 15 - #endif /* !(__SMP__) */ #define NO_PROC_ID 0xFF diff -ur linux-sched/include/asm-sparc64/smp.h linux-2.3.40/include/asm-sparc64/smp.h --- linux-sched/include/asm-sparc64/smp.h Sun Jan 23 04:34:05 2000 +++ linux-2.3.40/include/asm-sparc64/smp.h Sun Jan 23 19:40:08 2000 @@ -121,8 +121,6 @@ #endif /* !(__ASSEMBLY__) */ -#define PROC_CHANGE_PENALTY 20 - #endif /* !(__SMP__) */ #define NO_PROC_ID 0xFF diff -ur linux-sched/include/linux/sysctl.h linux-2.3.40/include/linux/sysctl.h --- linux-sched/include/linux/sysctl.h Sun Jan 23 04:34:05 2000 +++ linux-2.3.40/include/linux/sysctl.h Sun Jan 23 19:46:38 2000 @@ -110,7 +110,9 @@ KERN_SPARC_STOP_A=44, /* int: Sparc Stop-A enable */ KERN_SHMMNI=45, /* int: shm array identifiers */ KERN_OVERFLOWUID=46, /* int: overflow UID */ - KERN_OVERFLOWGID=47 /* int: overflow GID */ + KERN_OVERFLOWGID=47, /* int: overflow GID */ + KERN_PROC_CHANGE=48, /* int: processor change penalty */ + KERN_TLB_FLUSH=49 /* int: TLB flush penalty */ }; Only in linux-2.3.40/kernel: .printk.c.swp diff -ur linux-sched/kernel/sched.c linux-2.3.40/kernel/sched.c --- linux-sched/kernel/sched.c Thu Jan 20 12:51:42 2000 +++ linux-2.3.40/kernel/sched.c Sun Jan 23 19:43:11 2000 @@ -10,6 +10,8 @@ * 1998-11-19 Implemented schedule_timeout() and related stuff * by Andrea Arcangeli * 1998-12-28 Implemented better SMP scheduling by Ingo Molnar + * 2000-01-23 Put CPU change and TLB flush penalties in /proc + * by James Manning */ /* @@ -35,9 +37,17 @@ /* * scheduler variables + * + * Note: with so much SMP variance across the i386 arch alone, it made + * more sense (and less lines of code) to go ahead and consolidate. */ +#define DEFAULT_PROC_CHANGE_PENALTY 25 +#define DEFAULT_TLB_FLUSH_PENALTY 5 + unsigned securebits = SECUREBITS_DEFAULT; /* systemwide security settings */ +int sysctl_proc_change_penalty = DEFAULT_PROC_CHANGE_PENALTY; /* tuning */ +int sysctl_tlb_flush_penalty = DEFAULT_TLB_FLUSH_PENALTY; extern void mem_use(void); @@ -137,12 +147,12 @@ /* Give a largish advantage to the same processor... */ /* (this is equivalent to penalizing other processors) */ if (p->processor == this_cpu) - weight += PROC_CHANGE_PENALTY; + weight += sysctl_proc_change_penalty; #endif /* .. and a slight advantage to the current MM */ if (p->mm == this_mm) - weight += 1; + weight += sysctl_tlb_flush_penalty; weight += p->priority; out: diff -ur linux-sched/kernel/sysctl.c linux-2.3.40/kernel/sysctl.c --- linux-sched/kernel/sysctl.c Sun Jan 16 01:08:28 2000 +++ linux-2.3.40/kernel/sysctl.c Sun Jan 23 19:47:13 2000 @@ -37,6 +37,7 @@ /* External variables not in a header file. */ extern int panic_timeout; +extern int sysctl_proc_change_penalty, sysctl_tlb_flush_penalty; extern int console_loglevel, C_A_D; extern int bdf_prm[], bdflush_min[], bdflush_max[]; extern int sysctl_overcommit_memory; @@ -253,6 +254,10 @@ {KERN_OVERFLOWGID, "overflowgid", &overflowgid, sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &minolduid, &maxolduid}, + {KERN_PROC_CHANGE, "proc_change_penalty", &sysctl_proc_change_penalty, + sizeof(int), 0644, NULL, &proc_dointvec}, + {KERN_TLB_FLUSH, "tlb_flush_penalty", &sysctl_tlb_flush_penalty, + sizeof(int), 0644, NULL, &proc_dointvec}, {0} };