There's some really badly broken software out there that is entirely dependant on HZ for its maximum performance. Raise the maximum HZ value to some higher and slightly unreasonable values up to some higher and completely obscene values. Choose all the values based on the PIT clock to minimise clock drift. Signed-off-by: Con Kolivas --- arch/i386/kernel/cpu/proc.c | 2 arch/i386/kernel/smpboot.c | 2 arch/x86_64/kernel/setup.c | 2 include/linux/jiffies.h | 6 ++ include/linux/nfsd/stats.h | 4 - include/net/inet_timewait_sock.h | 10 ++-- include/net/pkt_sched.h | 8 ++- init/calibrate.c | 6 +- kernel/Kconfig.hz | 97 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 125 insertions(+), 12 deletions(-) Index: linux-2.6.20-ck1/include/linux/jiffies.h =================================================================== --- linux-2.6.20-ck1.orig/include/linux/jiffies.h 2007-02-05 22:52:04.000000000 +1100 +++ linux-2.6.20-ck1/include/linux/jiffies.h 2007-02-19 21:47:57.000000000 +1100 @@ -29,6 +29,12 @@ # define SHIFT_HZ 9 #elif HZ >= 768 && HZ < 1536 # define SHIFT_HZ 10 +#elif HZ >= 1536 && HZ < 3072 +# define SHIFT_HZ 11 +#elif HZ >= 3072 && HZ < 6144 +# define SHIFT_HZ 12 +#elif HZ >= 6144 && HZ < 12288 +# define SHIFT_HZ 13 #else # error You lose. #endif Index: linux-2.6.20-ck1/kernel/Kconfig.hz =================================================================== --- linux-2.6.20-ck1.orig/kernel/Kconfig.hz 2007-02-16 19:22:25.000000000 +1100 +++ linux-2.6.20-ck1/kernel/Kconfig.hz 2007-02-19 21:44:57.000000000 +1100 @@ -45,6 +45,93 @@ choice 1000 Hz is the preferred choice for desktop systems and other systems requiring fast interactive responses to events. + config HZ_121 + bool "121 HZ" + help + 121 Hz is a good choice for minimum overhead for servers, good power + saving for laptops and accurate clock performance based on the internal + PIT timer. Being between 100 and 1000 it is likely to be driver safe. + + config HZ_864 + bool "864 HZ" + help + 864 Hz is a good choice for minimum latency for desktops while + retaining accurate clock performance based on the internal + PIT timer. Being between 100 and 1000 it is likely to be driver safe. + + config HZ_1381 + bool "1381 HZ" + help + 1381 Hz is an insane value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_2299 + bool "2299 HZ" + help + 2299 Hz is an insane value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_3287 + bool "3287 HZ" + help + 3287 Hz is an insane value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_4143 + bool "4143 HZ" + help + 4143 Hz is an insane value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_5524 + bool "5524 HZ" + help + 5524 Hz is an obscene value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_6897 + bool "6897 HZ" + help + 6897 Hz is an obscene value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_8286 + bool "8286 HZ" + help + 8286 Hz is an obscene value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + config HZ_9861 + bool "9861 HZ" + help + 9861 Hz is an obscene value to use to run broken software that is Hz + limited, which is chosen to retain accurate clock performance based + on the internal PIT timer. + + Being over 1000, driver breakage is likely. + + endchoice config HZ @@ -53,4 +140,14 @@ config HZ default 250 if HZ_250_NODEFAULT default 300 if HZ_300 default 1000 if HZ_1000 + default 121 if HZ_121 + default 864 if HZ_864 + default 1381 if HZ_1381 + default 2299 if HZ_2299 + default 3287 if HZ_3287 + default 4143 if HZ_4143 + default 5524 if HZ_5524 + default 6897 if HZ_6897 + default 8286 if HZ_8286 + default 9861 if HZ_9861 Index: linux-2.6.20-ck1/include/net/inet_timewait_sock.h =================================================================== --- linux-2.6.20-ck1.orig/include/net/inet_timewait_sock.h 2007-02-05 22:52:04.000000000 +1100 +++ linux-2.6.20-ck1/include/net/inet_timewait_sock.h 2007-02-19 21:54:37.000000000 +1100 @@ -38,8 +38,8 @@ struct inet_hashinfo; * If time > 4sec, it is "slow" path, no recycling is required, * so that we select tick to get range about 4 seconds. */ -#if HZ <= 16 || HZ > 4096 -# error Unsupported: HZ <= 16 or HZ > 4096 +#if HZ <= 16 || HZ > 16384 +# error Unsupported: HZ <= 16 or HZ > 16384 #elif HZ <= 32 # define INET_TWDR_RECYCLE_TICK (5 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) #elif HZ <= 64 @@ -54,8 +54,12 @@ struct inet_hashinfo; # define INET_TWDR_RECYCLE_TICK (10 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) #elif HZ <= 2048 # define INET_TWDR_RECYCLE_TICK (11 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) -#else +#elif HZ <= 4096 # define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) +#elif HZ <= 8192 +# define INET_TWDR_RECYCLE_TICK (13 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) +#else +# define INET_TWDR_RECYCLE_TICK (14 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) #endif /* TIME_WAIT reaping mechanism. */ Index: linux-2.6.20-ck1/include/net/pkt_sched.h =================================================================== --- linux-2.6.20-ck1.orig/include/net/pkt_sched.h 2006-09-21 19:54:58.000000000 +1000 +++ linux-2.6.20-ck1/include/net/pkt_sched.h 2007-02-19 20:44:33.000000000 +1100 @@ -78,8 +78,14 @@ typedef long psched_tdiff_t; #define PSCHED_JSCALE 12 #elif HZ >= 384 && HZ < 768 #define PSCHED_JSCALE 11 -#elif HZ >= 768 +#elif HZ >= 768 && HZ < 1536 #define PSCHED_JSCALE 10 +#elif HZ >= 1536 && HZ < 3072 +#define PSCHED_JSCALE 9 +#elif HZ >= 3072 && HZ < 6144 +#define PSCHED_JSCALE 8 +#else +#define PSCHED_JSCALE 7 #endif #define PSCHED_GET_TIME(stamp) ((stamp) = (get_jiffies_64()<loops_per_jiffy/(500000/HZ), - (c->loops_per_jiffy/(5000/HZ)) % 100); + (c->loops_per_jiffy * 10/(50000/HZ)) % 100); seq_printf(m, "clflush size\t: %u\n\n", c->x86_clflush_size); return 0; Index: linux-2.6.20-ck1/arch/i386/kernel/smpboot.c =================================================================== --- linux-2.6.20-ck1.orig/arch/i386/kernel/smpboot.c 2007-02-19 21:57:48.000000000 +1100 +++ linux-2.6.20-ck1/arch/i386/kernel/smpboot.c 2007-02-19 21:58:04.000000000 +1100 @@ -1286,7 +1286,7 @@ static void __init smp_boot_cpus(unsigne "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", cpucount+1, bogosum/(500000/HZ), - (bogosum/(5000/HZ))%100); + (bogosum * 10/(50000/HZ))%100); Dprintk("Before bogocount - setting activated=1.\n"); Index: linux-2.6.20-ck1/include/linux/nfsd/stats.h =================================================================== --- linux-2.6.20-ck1.orig/include/linux/nfsd/stats.h 2007-02-19 22:00:54.000000000 +1100 +++ linux-2.6.20-ck1/include/linux/nfsd/stats.h 2007-02-19 22:01:36.000000000 +1100 @@ -35,8 +35,8 @@ struct nfsd_stats { }; -/* thread usage wraps very million seconds (approx one fortnight) */ -#define NFSD_USAGE_WRAP (HZ*1000000) +/* thread usage wraps every one hundred thousand seconds (approx one day) */ +#define NFSD_USAGE_WRAP (HZ*100000) #ifdef __KERNEL__ Index: linux-2.6.20-ck1/arch/x86_64/kernel/setup.c =================================================================== --- linux-2.6.20-ck1.orig/arch/x86_64/kernel/setup.c 2007-02-19 22:08:05.000000000 +1100 +++ linux-2.6.20-ck1/arch/x86_64/kernel/setup.c 2007-02-19 22:08:16.000000000 +1100 @@ -1168,7 +1168,7 @@ static int show_cpuinfo(struct seq_file seq_printf(m, "\nbogomips\t: %lu.%02lu\n", c->loops_per_jiffy/(500000/HZ), - (c->loops_per_jiffy/(5000/HZ)) % 100); + (c->loops_per_jiffy * 10/(50000/HZ)) % 100); if (c->x86_tlbsize > 0) seq_printf(m, "TLB size\t: %d 4K pages\n", c->x86_tlbsize);