diff -Naurp linux-2.4-ts11/Documentation/Configure.help linux-2.4-ts11-vhz/Documentation/Configure.help
--- linux-2.4-ts11/Documentation/Configure.help	2004-08-04 03:33:00.000000000 +0200
+++ linux-2.4-ts11-vhz/Documentation/Configure.help	2008-05-21 20:36:16.000000000 +0200
@@ -2656,6 +2656,18 @@ CONFIG_HEARTBEAT
   behaviour is platform-dependent, but normally the flash frequency is
   a hyperbolic function of the 5-minute load average.
 
+Timer frequency
+CONFIG_HZ
+  The frequency the system timer interrupt pops.  Higher tick values provide
+  improved granularity of timers, improved select() and poll() performance,
+  and lower scheduling latency.  Higher values, however, increase interrupt
+  overhead and will allow jiffie wraparound sooner.  For compatibility, the
+  tick count is always exported as if HZ=100.
+
+  The default value, which was the value for all of eternity, is 100.  If
+  you are looking to provide better timer granularity or increased desktop
+  performance, try 500 or 1000.  In unsure, go with the default of 100.
+
 Networking support
 CONFIG_NET
   Unless you really know what you are doing, you should say Y here.
diff -Naurp linux-2.4-ts11/arch/arm/config.in linux-2.4-ts11-vhz/arch/arm/config.in
--- linux-2.4-ts11/arch/arm/config.in	2006-02-09 23:58:57.000000000 +0100
+++ linux-2.4-ts11-vhz/arch/arm/config.in	2008-05-21 20:36:16.000000000 +0200
@@ -498,6 +498,8 @@ endmenu
 mainmenu_option next_comment
 comment 'General setup'
 
+int 'Timer frequency (HZ) (100)' CONFIG_HZ 100
+
 # Now handle the bus types
 if [ "$CONFIG_ARCH_FTVPCI" = "y" -o \
      "$CONFIG_ARCH_SHARK" = "y" -o \
diff -Naurp linux-2.4-ts11/arch/cris/drivers/serial.h linux-2.4-ts11-vhz/arch/cris/drivers/serial.h
--- linux-2.4-ts11/arch/cris/drivers/serial.h	2004-08-04 03:25:40.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/cris/drivers/serial.h	2008-05-21 20:46:09.000000000 +0200
@@ -78,8 +78,8 @@ struct e100_serial {
 	int			ignore_status_mask;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			line;
diff -Naurp linux-2.4-ts11/arch/i386/config.in linux-2.4-ts11-vhz/arch/i386/config.in
--- linux-2.4-ts11/arch/i386/config.in	2004-08-04 03:25:41.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/i386/config.in	2008-05-21 20:36:16.000000000 +0200
@@ -267,6 +267,7 @@ endmenu
 mainmenu_option next_comment
 comment 'General setup'
 
+int 'Timer frequency (HZ) (100)' CONFIG_HZ 100
 bool 'Networking support' CONFIG_NET
 
 # Visual Workstation support is utterly broken.
diff -Naurp linux-2.4-ts11/arch/mips64/kernel/ioctl32.c linux-2.4-ts11-vhz/arch/mips64/kernel/ioctl32.c
--- linux-2.4-ts11/arch/mips64/kernel/ioctl32.c	2004-08-04 03:25:55.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/mips64/kernel/ioctl32.c	2008-05-21 20:48:14.000000000 +0200
@@ -1054,12 +1054,12 @@ struct serial_struct32 {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	io_type;
 	char	reserved_char[1];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	__u32 iomem_base;
 	unsigned short	iomem_reg_shift;
 	unsigned int	port_high;
diff -Naurp linux-2.4-ts11/arch/parisc/kernel/ioctl32.c linux-2.4-ts11-vhz/arch/parisc/kernel/ioctl32.c
--- linux-2.4-ts11/arch/parisc/kernel/ioctl32.c	2004-08-04 03:26:02.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/parisc/kernel/ioctl32.c	2008-05-21 20:48:14.000000000 +0200
@@ -2823,12 +2823,12 @@ struct serial_struct32 {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	io_type;
 	char	reserved_char[1];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	unsigned int	iomem_base;	/* char * really */
 	unsigned short	iomem_reg_shift;
 	unsigned int	port_high;
diff -Naurp linux-2.4-ts11/arch/ppc/8xx_io/uart.c linux-2.4-ts11-vhz/arch/ppc/8xx_io/uart.c
--- linux-2.4-ts11/arch/ppc/8xx_io/uart.c	2004-08-04 03:26:06.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/ppc/8xx_io/uart.c	2008-05-21 20:46:14.000000000 +0200
@@ -224,8 +224,8 @@ typedef struct serial_info {
 	int			line;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			blocked_open; /* # of blocked opens */
diff -Naurp linux-2.4-ts11/arch/ppc/cpm2_io/uart.c linux-2.4-ts11-vhz/arch/ppc/cpm2_io/uart.c
--- linux-2.4-ts11/arch/ppc/cpm2_io/uart.c	2004-08-04 03:26:08.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/ppc/cpm2_io/uart.c	2008-05-21 20:46:14.000000000 +0200
@@ -210,8 +210,8 @@ typedef struct serial_info {
 	int			line;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			blocked_open; /* # of blocked opens */
diff -Naurp linux-2.4-ts11/arch/x86_64/ia32/ia32_ioctl.c linux-2.4-ts11-vhz/arch/x86_64/ia32/ia32_ioctl.c
--- linux-2.4-ts11/arch/x86_64/ia32/ia32_ioctl.c	2004-08-04 03:26:19.000000000 +0200
+++ linux-2.4-ts11-vhz/arch/x86_64/ia32/ia32_ioctl.c	2008-05-21 20:48:18.000000000 +0200
@@ -2818,12 +2818,12 @@ struct serial_struct32 {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	io_type;
 	char	reserved_char[1];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	__u32 iomem_base;
 	unsigned short	iomem_reg_shift;
 	unsigned int	port_high;
diff -Naurp linux-2.4-ts11/drivers/char/dtlk.c linux-2.4-ts11-vhz/drivers/char/dtlk.c
--- linux-2.4-ts11/drivers/char/dtlk.c	2004-07-22 21:49:51.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/dtlk.c	2008-05-21 20:42:15.000000000 +0200
@@ -209,7 +209,7 @@ static ssize_t dtlk_write(struct file *f
 				   up to 250 usec for the RDY bit to
 				   go nonzero. */
 				for (retries = 0;
-				     retries < loops_per_jiffy / (4000/HZ);
+				     retries < HZ*(loops_per_jiffy>>5)/125;
 				     retries++)
 					if (inb_p(dtlk_port_tts) &
 					    TTS_WRITABLE)
diff -Naurp linux-2.4-ts11/drivers/char/dz.h linux-2.4-ts11-vhz/drivers/char/dz.h
--- linux-2.4-ts11/drivers/char/dz.h	2004-07-22 21:49:50.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/dz.h	2008-05-21 20:48:22.000000000 +0200
@@ -139,8 +139,8 @@ struct dz_serial {
   int                     flags; 
   int                     baud_base;
   int                     blocked_open;
-  unsigned short          close_delay;
-  unsigned short          closing_wait;
+  unsigned int          close_delay;
+  unsigned int          closing_wait;
   unsigned short          line;                /* port/line number */
   unsigned short          cflags;              /* line configuration flag */
   unsigned short          x_char;              /* xon/xoff character */
diff -Naurp linux-2.4-ts11/drivers/char/moxa.c linux-2.4-ts11-vhz/drivers/char/moxa.c
--- linux-2.4-ts11/drivers/char/moxa.c	2004-07-22 21:49:51.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/moxa.c	2008-05-21 20:46:22.000000000 +0200
@@ -147,7 +147,7 @@ struct moxa_str {
 	int type;
 	int port;
 	int close_delay;
-	unsigned short closing_wait;
+	unsigned int closing_wait;
 	int count;
 	int blocked_open;
 	long event; /* long req'd for set_bit --RR */
diff -Naurp linux-2.4-ts11/drivers/char/mxser.c linux-2.4-ts11-vhz/drivers/char/mxser.c
--- linux-2.4-ts11/drivers/char/mxser.c	2004-07-22 21:49:51.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/mxser.c	2008-05-21 20:46:22.000000000 +0200
@@ -253,7 +253,7 @@ struct mxser_struct {
 	int custom_divisor;
 	int x_char;		/* xon/xoff character */
 	int close_delay;
-	unsigned short closing_wait;
+	unsigned int closing_wait;
 	int IER;		/* Interrupt Enable Register */
 	int MCR;		/* Modem control register */
 	unsigned long event;
diff -Naurp linux-2.4-ts11/drivers/char/pcmcia/synclink_cs.c linux-2.4-ts11-vhz/drivers/char/pcmcia/synclink_cs.c
--- linux-2.4-ts11/drivers/char/pcmcia/synclink_cs.c	2004-08-04 03:28:51.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/pcmcia/synclink_cs.c	2008-05-21 20:48:23.000000000 +0200
@@ -155,8 +155,8 @@ typedef struct _mgslpc_info {
 	int			flags;
 	int			count;		/* count of opens */
 	int			line;
-	unsigned short		close_delay;
-	unsigned short		closing_wait;	/* time to wait before closing */
+	unsigned int		close_delay;
+	unsigned int		closing_wait;	/* time to wait before closing */
 	
 	struct mgsl_icount	icount;
 	
diff -Naurp linux-2.4-ts11/drivers/char/riscom8.h linux-2.4-ts11-vhz/drivers/char/riscom8.h
--- linux-2.4-ts11/drivers/char/riscom8.h	2004-07-22 21:49:52.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/riscom8.h	2008-05-21 20:46:22.000000000 +0200
@@ -89,7 +89,7 @@ struct riscom_port {
 	struct tq_struct	tqueue_hangup;
 	short			wakeup_chars;
 	short			break_length;
-	unsigned short		closing_wait;
+	unsigned int		closing_wait;
 	unsigned char		mark_mask;
 	unsigned char		IER;
 	unsigned char		MSVR;
diff -Naurp linux-2.4-ts11/drivers/char/sgiserial.h linux-2.4-ts11-vhz/drivers/char/sgiserial.h
--- linux-2.4-ts11/drivers/char/sgiserial.h	2004-08-04 03:28:45.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/sgiserial.h	2008-05-21 20:48:24.000000000 +0200
@@ -39,11 +39,11 @@ struct serial_struct {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	reserved_char[2];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	int	reserved[4];
 };
 
@@ -138,8 +138,8 @@ struct sgi_serial {
 	int			custom_divisor;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			line;
diff -Naurp linux-2.4-ts11/drivers/char/specialix_io8.h linux-2.4-ts11-vhz/drivers/char/specialix_io8.h
--- linux-2.4-ts11/drivers/char/specialix_io8.h	2004-07-22 21:49:50.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/specialix_io8.h	2008-05-21 20:46:22.000000000 +0200
@@ -128,7 +128,7 @@ struct specialix_port {
 	struct tq_struct	tqueue_hangup;
 	short			wakeup_chars;
 	short			break_length;
-	unsigned short		closing_wait;
+	unsigned int		closing_wait;
 	unsigned char		mark_mask;
 	unsigned char		IER;
 	unsigned char		MSVR;
diff -Naurp linux-2.4-ts11/drivers/char/synclink.c linux-2.4-ts11-vhz/drivers/char/synclink.c
--- linux-2.4-ts11/drivers/char/synclink.c	2004-08-04 03:28:45.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/synclink.c	2008-05-21 20:48:24.000000000 +0200
@@ -199,8 +199,8 @@ struct mgsl_struct {
 	int			count;		/* count of opens */
 	int			line;
 	int                     hw_version;
-	unsigned short		close_delay;
-	unsigned short		closing_wait;	/* time to wait before closing */
+	unsigned int		close_delay;
+	unsigned int		closing_wait;	/* time to wait before closing */
 	
 	struct mgsl_icount	icount;
 	
diff -Naurp linux-2.4-ts11/drivers/char/synclinkmp.c linux-2.4-ts11-vhz/drivers/char/synclinkmp.c
--- linux-2.4-ts11/drivers/char/synclinkmp.c	2004-08-04 03:28:46.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/char/synclinkmp.c	2008-05-21 20:48:24.000000000 +0200
@@ -162,8 +162,8 @@ typedef struct _synclinkmp_info {
 	int			flags;
 	int			count;		/* count of opens */
 	int			line;
-	unsigned short		close_delay;
-	unsigned short		closing_wait;	/* time to wait before closing */
+	unsigned int		close_delay;
+	unsigned int		closing_wait;	/* time to wait before closing */
 
 	struct mgsl_icount	icount;
 
diff -Naurp linux-2.4-ts11/drivers/macintosh/macserial.h linux-2.4-ts11-vhz/drivers/macintosh/macserial.h
--- linux-2.4-ts11/drivers/macintosh/macserial.h	2004-07-22 21:50:27.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/macintosh/macserial.h	2008-05-21 20:48:26.000000000 +0200
@@ -20,11 +20,11 @@ struct serial_struct {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	reserved_char[2];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	int	reserved[4];
 };
 
@@ -146,8 +146,8 @@ struct mac_serial {
 	int			custom_divisor;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			line;
diff -Naurp linux-2.4-ts11/drivers/net/wan/8253x/8253x.h linux-2.4-ts11-vhz/drivers/net/wan/8253x/8253x.h
--- linux-2.4-ts11/drivers/net/wan/8253x/8253x.h	2004-08-04 03:29:25.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/net/wan/8253x/8253x.h	2008-05-21 20:46:28.000000000 +0200
@@ -372,8 +372,8 @@ typedef struct sab_port 
 
 	int			x_char;
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	int			all_sent;
 	int			is_console;
 #define OPEN_NOT 0
diff -Naurp linux-2.4-ts11/drivers/net/wan/z85230.h linux-2.4-ts11-vhz/drivers/net/wan/z85230.h
--- linux-2.4-ts11/drivers/net/wan/z85230.h	2004-07-22 21:49:36.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/net/wan/z85230.h	2008-05-21 20:46:29.000000000 +0200
@@ -351,7 +351,7 @@ struct z8530_channel
 	int			xmit_fifo_size;	/* Transmit FIFO info */
 
 	int			close_delay;	/* Do we wait for drain on close ? */
-	unsigned short		closing_wait;
+	unsigned int		closing_wait;
 
 	/* We need to know the current clock divisor
 	 * to read the bps rate the chip has currently
diff -Naurp linux-2.4-ts11/drivers/sbus/char/aurora.h linux-2.4-ts11-vhz/drivers/sbus/char/aurora.h
--- linux-2.4-ts11/drivers/sbus/char/aurora.h	2004-08-04 03:29:30.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/sbus/char/aurora.h	2008-05-21 20:46:30.000000000 +0200
@@ -261,7 +261,7 @@ struct Aurora_port {
 	struct tq_struct	tqueue_hangup;
 	short			wakeup_chars;
 	short			break_length;
-	unsigned short		closing_wait;
+	unsigned int		closing_wait;
 	unsigned char		mark_mask;
 	unsigned char		SRER;
 	unsigned char		MSVR;
diff -Naurp linux-2.4-ts11/drivers/sbus/char/su.c linux-2.4-ts11-vhz/drivers/sbus/char/su.c
--- linux-2.4-ts11/drivers/sbus/char/su.c	2004-08-04 03:29:31.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/sbus/char/su.c	2008-05-21 20:48:31.000000000 +0200
@@ -128,8 +128,8 @@ struct su_struct {
 
 	int		 xmit_fifo_size;
 	int		 custom_divisor;
-	unsigned short	 close_delay;
-	unsigned short	 closing_wait;	/* time to wait before closing */
+	unsigned int	 close_delay;
+	unsigned int	 closing_wait;	/* time to wait before closing */
 
 	struct tty_struct 	*tty;
 	int			read_status_mask;
diff -Naurp linux-2.4-ts11/drivers/sbus/char/zs.h linux-2.4-ts11-vhz/drivers/sbus/char/zs.h
--- linux-2.4-ts11/drivers/sbus/char/zs.h	2004-08-04 03:29:31.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/sbus/char/zs.h	2008-05-21 20:48:32.000000000 +0200
@@ -34,11 +34,11 @@ struct serial_struct {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	reserved_char[2];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	int	reserved[4];
 };
 
@@ -134,8 +134,8 @@ struct sun_serial {
 	int			custom_divisor;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			line;
diff -Naurp linux-2.4-ts11/drivers/tc/zs.h linux-2.4-ts11-vhz/drivers/tc/zs.h
--- linux-2.4-ts11/drivers/tc/zs.h	2004-08-04 03:29:51.000000000 +0200
+++ linux-2.4-ts11-vhz/drivers/tc/zs.h	2008-05-21 20:48:35.000000000 +0200
@@ -20,11 +20,11 @@ struct serial_struct {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	reserved_char[2];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	int	reserved[4];
 };
 
@@ -137,8 +137,8 @@ struct dec_serial {
 	int			custom_divisor;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			line;
diff -Naurp linux-2.4-ts11/fs/proc/array.c linux-2.4-ts11-vhz/fs/proc/array.c
--- linux-2.4-ts11/fs/proc/array.c	2004-08-04 03:33:34.000000000 +0200
+++ linux-2.4-ts11-vhz/fs/proc/array.c	2008-05-21 20:36:16.000000000 +0200
@@ -362,15 +362,15 @@ int proc_pid_stat(struct task_struct *ta
 		task->cmin_flt,
 		task->maj_flt,
 		task->cmaj_flt,
-		hz_to_std(task->times.tms_utime),
-		hz_to_std(task->times.tms_stime),
-		hz_to_std(task->times.tms_cutime),
-		hz_to_std(task->times.tms_cstime),
+		jiffies_to_clock_t(task->times.tms_utime),
+		jiffies_to_clock_t(task->times.tms_stime),
+		jiffies_to_clock_t(task->times.tms_cutime),
+		jiffies_to_clock_t(task->times.tms_cstime),
 		priority,
 		nice,
 		0UL /* removed */,
-		task->it_real_value,
-		hz_to_std(task->start_time),
+		jiffies_to_clock_t(task->it_real_value),
+		jiffies_to_clock_t(task->start_time),
 		vsize,
 		mm ? mm->rss : 0, /* you might want to shift this left 3 */
 		task->rlim[RLIMIT_RSS].rlim_cur,
@@ -613,14 +613,14 @@ int proc_pid_cpu(struct task_struct *tas
 
 	len = sprintf(buffer,
 		"cpu  %lu %lu\n",
-		hz_to_std(task->times.tms_utime),
-		hz_to_std(task->times.tms_stime));
+		jiffies_to_clock_t(task->times.tms_utime),
+		jiffies_to_clock_t(task->times.tms_stime));
 		
 	for (i = 0 ; i < smp_num_cpus; i++)
 		len += sprintf(buffer + len, "cpu%d %lu %lu\n",
 			i,
-			hz_to_std(task->per_cpu_utime[cpu_logical_map(i)]),
-			hz_to_std(task->per_cpu_stime[cpu_logical_map(i)]));
+			jiffies_to_clock_t(task->per_cpu_utime[cpu_logical_map(i)]),
+			jiffies_to_clock_t(task->per_cpu_stime[cpu_logical_map(i)]));
 
 	return len;
 }
diff -Naurp linux-2.4-ts11/fs/proc/proc_misc.c linux-2.4-ts11-vhz/fs/proc/proc_misc.c
--- linux-2.4-ts11/fs/proc/proc_misc.c	2004-08-04 03:33:34.000000000 +0200
+++ linux-2.4-ts11-vhz/fs/proc/proc_misc.c	2008-05-21 20:36:16.000000000 +0200
@@ -308,16 +308,16 @@ static int kstat_read_proc(char *page, c
 {
 	int i, len = 0;
 	extern unsigned long total_forks;
-	unsigned long jif = hz_to_std(jiffies);
+	unsigned long jif = jiffies_to_clock_t(jiffies);
 	unsigned int sum = 0, user = 0, nice = 0, system = 0;
 	int major, disk;
 
 	for (i = 0 ; i < smp_num_cpus; i++) {
 		int cpu = cpu_logical_map(i), j;
 
-		user += hz_to_std(kstat.per_cpu_user[cpu]);
-		nice += hz_to_std(kstat.per_cpu_nice[cpu]);
-		system += hz_to_std(kstat.per_cpu_system[cpu]);
+		user += jiffies_to_clock_t(kstat.per_cpu_user[cpu]);
+		nice += jiffies_to_clock_t(kstat.per_cpu_nice[cpu]);
+		system += jiffies_to_clock_t(kstat.per_cpu_system[cpu]);
 #if !defined(CONFIG_ARCH_S390)
 		for (j = 0 ; j < NR_IRQS ; j++)
 			sum += kstat.irqs[cpu][j];
@@ -331,10 +331,10 @@ static int kstat_read_proc(char *page, c
 		proc_sprintf(page, &off, &len,
 			"cpu%d %u %u %u %lu\n",
 			i,
-			hz_to_std(kstat.per_cpu_user[cpu_logical_map(i)]),
-			hz_to_std(kstat.per_cpu_nice[cpu_logical_map(i)]),
-			hz_to_std(kstat.per_cpu_system[cpu_logical_map(i)]),
-			jif - hz_to_std(  kstat.per_cpu_user[cpu_logical_map(i)] \
+			jiffies_to_clock_t(kstat.per_cpu_user[cpu_logical_map(i)]),
+			jiffies_to_clock_t(kstat.per_cpu_nice[cpu_logical_map(i)]),
+			jiffies_to_clock_t(kstat.per_cpu_system[cpu_logical_map(i)]),
+			jif - jiffies_to_clock_t(  kstat.per_cpu_user[cpu_logical_map(i)] \
 				   + kstat.per_cpu_nice[cpu_logical_map(i)] \
 				   + kstat.per_cpu_system[cpu_logical_map(i)]));
 	proc_sprintf(page, &off, &len,
diff -Naurp linux-2.4-ts11/include/asm-arm/arch-ep93xx/param.h linux-2.4-ts11-vhz/include/asm-arm/arch-ep93xx/param.h
--- linux-2.4-ts11/include/asm-arm/arch-ep93xx/param.h	2004-07-22 21:50:54.000000000 +0200
+++ linux-2.4-ts11-vhz/include/asm-arm/arch-ep93xx/param.h	2008-05-21 20:36:16.000000000 +0200
@@ -19,3 +19,4 @@
  */
 
 #define HZ 100
+
diff -Naurp linux-2.4-ts11/include/asm-arm/param.h linux-2.4-ts11-vhz/include/asm-arm/param.h
--- linux-2.4-ts11/include/asm-arm/param.h	2006-05-03 18:51:10.000000000 +0200
+++ linux-2.4-ts11-vhz/include/asm-arm/param.h	2008-05-21 20:36:16.000000000 +0200
@@ -10,14 +10,18 @@
 #ifndef __ASM_PARAM_H
 #define __ASM_PARAM_H
 
-#include <asm/arch/param.h>	/* for HZ */
 #include <asm/proc/page.h>	/* for EXEC_PAGE_SIZE */
+#include <linux/config.h>
 
-#ifndef HZ
-#define HZ 100
+#ifdef __KERNEL__
+# define HZ		CONFIG_HZ	/* internal kernel timer frequency */
+# define USER_HZ	100		/* some user interfaces are in ticks */
+# define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */
+# define jiffies_to_clock_t(x)	((x) / ((HZ) / (USER_HZ)))
 #endif
-#if defined(__KERNEL__) && (HZ == 100)
-#define hz_to_std(a) (a)
+
+#ifndef HZ
+#define HZ 100				/* if userspace cheats, give them 100 */
 #endif
 
 #ifndef NGROUPS
@@ -31,9 +35,5 @@
 /* max length of hostname */
 #define MAXHOSTNAMELEN  64
 
-#ifdef __KERNEL__
-# define CLOCKS_PER_SEC	HZ
-#endif
-
 #endif
 
diff -Naurp linux-2.4-ts11/include/asm-i386/param.h linux-2.4-ts11-vhz/include/asm-i386/param.h
--- linux-2.4-ts11/include/asm-i386/param.h	2004-07-22 21:50:45.000000000 +0200
+++ linux-2.4-ts11-vhz/include/asm-i386/param.h	2008-05-21 20:36:16.000000000 +0200
@@ -1,18 +1,17 @@
 #ifndef _ASMi386_PARAM_H
 #define _ASMi386_PARAM_H
 
-#ifndef HZ
-#define HZ 100
+#include <linux/config.h>
+
 #ifdef __KERNEL__
-#if HZ == 100
-/* X86 is defined to provide userspace with a world where HZ=100
-   We have to do this, (x*const)/const2 isnt optimised out because its not
-   a null operation as it might overflow.. */
-#define hz_to_std(a) (a)
-#else
-#define hz_to_std(a) ((a)*(100/HZ)+((a)*(100%HZ))/HZ)
-#endif
+# define HZ		CONFIG_HZ	/* internal kernel timer frequency */
+# define USER_HZ	100		/* some user interfaces are in ticks */
+# define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */
+# define jiffies_to_clock_t(x)	((x) / ((HZ) / (USER_HZ)))
 #endif
+
+#ifndef HZ
+#define HZ 100				/* if userspace cheats, give them 100 */
 #endif
 
 #define EXEC_PAGESIZE	4096
@@ -27,8 +26,4 @@
 
 #define MAXHOSTNAMELEN	64	/* max length of hostname */
 
-#ifdef __KERNEL__
-# define CLOCKS_PER_SEC	100	/* frequency at which times() counts */
-#endif
-
 #endif
diff -Naurp linux-2.4-ts11/include/asm-sparc64/sab82532.h linux-2.4-ts11-vhz/include/asm-sparc64/sab82532.h
--- linux-2.4-ts11/include/asm-sparc64/sab82532.h	2004-08-04 03:17:25.000000000 +0200
+++ linux-2.4-ts11-vhz/include/asm-sparc64/sab82532.h	2008-05-21 20:46:47.000000000 +0200
@@ -149,8 +149,8 @@ struct sab82532 {
 	unsigned int			 tec_timeout;
 	int				 x_char;
 	int				 close_delay;
-	unsigned short			 closing_wait;
-	unsigned short			 closing_wait2;
+	unsigned int			 closing_wait;
+	unsigned int			 closing_wait2;
 	unsigned long			 irqflags;
 	int				 is_console;
 	unsigned char			 interrupt_mask0;
diff -Naurp linux-2.4-ts11/include/linux/cyclades.h linux-2.4-ts11-vhz/include/linux/cyclades.h
--- linux-2.4-ts11/include/linux/cyclades.h	2004-08-04 03:17:27.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/cyclades.h	2008-05-21 20:46:47.000000000 +0200
@@ -583,7 +583,7 @@ struct cyclades_port {
 	int			custom_divisor;
 	int                     x_char; /* to be pushed out ASAP */
 	int			close_delay;
-	unsigned short		closing_wait;
+	unsigned int		closing_wait;
 	unsigned long		event;
 	unsigned long		last_active;
 	int			count;	/* # of fd on device */
diff -Naurp linux-2.4-ts11/include/linux/generic_serial.h linux-2.4-ts11-vhz/include/linux/generic_serial.h
--- linux-2.4-ts11/include/linux/generic_serial.h	2004-07-22 21:50:33.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/generic_serial.h	2008-05-21 20:46:47.000000000 +0200
@@ -46,7 +46,7 @@ struct gs_port {
   int                     blocked_open;
   struct tty_struct       *tty;
   int                     event;
-  unsigned short          closing_wait;
+  unsigned int          closing_wait;
   int                     close_delay;
   struct real_driver      *rd;
   int                     wakeup_chars;
diff -Naurp linux-2.4-ts11/include/linux/hayesesp.h linux-2.4-ts11-vhz/include/linux/hayesesp.h
--- linux-2.4-ts11/include/linux/hayesesp.h	2004-07-22 21:50:32.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/hayesesp.h	2008-05-21 20:46:47.000000000 +0200
@@ -87,8 +87,8 @@ struct esp_struct {
 	int			stat_flags;
 	int			custom_divisor;
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	int			IER; 	/* Interrupt Enable Register */
 	int			MCR; 	/* Modem control register */
 	unsigned long		event;
diff -Naurp linux-2.4-ts11/include/linux/isicom.h linux-2.4-ts11-vhz/include/linux/isicom.h
--- linux-2.4-ts11/include/linux/isicom.h	2004-07-22 21:50:34.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/isicom.h	2008-05-21 20:46:48.000000000 +0200
@@ -147,7 +147,7 @@ struct	isi_port {
 	int			close_delay;
 	unsigned short		channel;
 	unsigned short		status;
-	unsigned short		closing_wait;
+	unsigned int		closing_wait;
 	long 			session;
 	long			pgrp;
 	struct isi_board	* card;
diff -Naurp linux-2.4-ts11/include/linux/serial.h linux-2.4-ts11-vhz/include/linux/serial.h
--- linux-2.4-ts11/include/linux/serial.h	2006-06-17 01:23:09.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/serial.h	2008-05-21 20:48:50.000000000 +0200
@@ -39,12 +39,12 @@ struct serial_struct {
 	int	xmit_fifo_size;
 	int	custom_divisor;
 	int	baud_base;
-	unsigned short	close_delay;
+	unsigned int	close_delay;
 	char	io_type;
 	char	reserved_char[1];
 	int	hub6;
-	unsigned short	closing_wait; /* time to wait before closing */
-	unsigned short	closing_wait2; /* no longer used... */
+	unsigned int	closing_wait; /* time to wait before closing */
+	unsigned int	closing_wait2; /* no longer used... */
 	unsigned char	*iomem_base;
 	unsigned short	iomem_reg_shift;
 	unsigned int	port_high;
diff -Naurp linux-2.4-ts11/include/linux/serialP.h linux-2.4-ts11-vhz/include/linux/serialP.h
--- linux-2.4-ts11/include/linux/serialP.h	2006-06-17 01:23:19.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/serialP.h	2008-05-21 20:48:50.000000000 +0200
@@ -45,8 +45,8 @@ struct serial_state {
 	int	count;
 	u8	*iomem_base;
 	u16	iomem_reg_shift;
-	unsigned short	close_delay;
-	unsigned short	closing_wait; /* time to wait before closing */
+	unsigned int	close_delay;
+	unsigned int	closing_wait; /* time to wait before closing */
 	struct async_icount	icount;	
 	struct termios		normal_termios;
 	struct termios		callout_termios;
@@ -69,8 +69,8 @@ struct async_struct {
 	int			quot;
 	int			x_char;	/* xon/xoff character */
 	int			close_delay;
-	unsigned short		closing_wait;
-	unsigned short		closing_wait2;
+	unsigned int		closing_wait;
+	unsigned int		closing_wait2;
 	int			IER; 	/* Interrupt Enable Register */
 	int			MCR; 	/* Modem control register */
 	int			LCR; 	/* Line control register */
diff -Naurp linux-2.4-ts11/include/linux/timex.h linux-2.4-ts11-vhz/include/linux/timex.h
--- linux-2.4-ts11/include/linux/timex.h	2006-05-03 18:51:10.000000000 +0200
+++ linux-2.4-ts11-vhz/include/linux/timex.h	2008-05-21 20:57:55.000000000 +0200
@@ -74,6 +74,20 @@
 # 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
+#elif HZ >= 12288 && HZ < 24576
+# define SHIFT_HZ	14
+#elif HZ >= 24576 && HZ < 49152
+# define SHIFT_HZ	15
+#elif HZ >= 49152 && HZ < 98304
+# define SHIFT_HZ	16
+#elif HZ >= 98304 && HZ < 196608
+# define SHIFT_HZ	17
 #else
 # error You lose.
 #endif
diff -Naurp linux-2.4-ts11/include/net/irda/ircomm_tty.h linux-2.4-ts11-vhz/include/net/irda/ircomm_tty.h
--- linux-2.4-ts11/include/net/irda/ircomm_tty.h	2004-08-04 03:17:36.000000000 +0200
+++ linux-2.4-ts11-vhz/include/net/irda/ircomm_tty.h	2008-05-21 20:47:57.000000000 +0200
@@ -99,8 +99,8 @@ struct ircomm_tty_cb {
 	struct timer_list watchdog_timer;
 	struct tq_struct  tqueue;
 
-        unsigned short    close_delay;
-        unsigned short    closing_wait; /* time to wait before closing */
+        unsigned int    close_delay;
+        unsigned int    closing_wait; /* time to wait before closing */
 
 	long session;           /* Session of opening process */
 	long pgrp;		/* pgrp of opening process */
diff -Naurp linux-2.4-ts11/include/net/tcp.h linux-2.4-ts11-vhz/include/net/tcp.h
--- linux-2.4-ts11/include/net/tcp.h	2006-06-17 01:24:26.000000000 +0200
+++ linux-2.4-ts11-vhz/include/net/tcp.h	2008-05-21 20:30:26.000000000 +0200
@@ -375,8 +375,8 @@ static __inline__ int tcp_sk_listen_hash
    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 > 131072 
+# error Unsupported: HZ <= 16 or HZ > 131072
 #elif HZ <= 32
 # define TCP_TW_RECYCLE_TICK (5+2-TCP_TW_RECYCLE_SLOTS_LOG)
 #elif HZ <= 64
@@ -391,8 +391,18 @@ static __inline__ int tcp_sk_listen_hash
 # define TCP_TW_RECYCLE_TICK (10+2-TCP_TW_RECYCLE_SLOTS_LOG)
 #elif HZ <= 2048
 # define TCP_TW_RECYCLE_TICK (11+2-TCP_TW_RECYCLE_SLOTS_LOG)
-#else
+#elif HZ <= 4096
 # define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ <= 8192
+# define TCP_TW_RECYCLE_TICK (13+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ <= 16384
+# define TCP_TW_RECYCLE_TICK (14+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ <= 32768
+# define TCP_TW_RECYCLE_TICK (15+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#elif HZ <= 65536
+# define TCP_TW_RECYCLE_TICK (16+2-TCP_TW_RECYCLE_SLOTS_LOG)
+#else
+# define TCP_TW_RECYCLE_TICK (17+2-TCP_TW_RECYCLE_SLOTS_LOG)
 #endif
 
 /*
diff -Naurp linux-2.4-ts11/init/main.c linux-2.4-ts11-vhz/init/main.c
--- linux-2.4-ts11/init/main.c	2006-05-23 01:05:13.000000000 +0200
+++ linux-2.4-ts11-vhz/init/main.c	2008-05-21 20:32:24.000000000 +0200
@@ -225,8 +225,8 @@ void __init calibrate_delay(void)
 end_calibrate_delay:
 /* Round the value and print it */	
 	printk("%lu.%02lu BogoMIPS\n",
-		loops_per_jiffy/(500000/HZ),
-		(loops_per_jiffy/(5000/HZ)) % 100);
+		HZ*(loops_per_jiffy>>3)/62500,
+		(HZ*(loops_per_jiffy>>3)/625) % 100);
 //	printk(KERN_ERR "loops_per_jiffy=%lu\n",loops_per_jiffy);
 }
 
diff -Naurp linux-2.4-ts11/kernel/signal.c linux-2.4-ts11-vhz/kernel/signal.c
--- linux-2.4-ts11/kernel/signal.c	2004-08-04 03:33:52.000000000 +0200
+++ linux-2.4-ts11-vhz/kernel/signal.c	2008-05-21 20:36:16.000000000 +0200
@@ -13,7 +13,7 @@
 #include <linux/smp_lock.h>
 #include <linux/init.h>
 #include <linux/sched.h>
-
+#include <asm/param.h>
 #include <asm/uaccess.h>
 
 /*
@@ -778,8 +778,8 @@ void do_notify_parent(struct task_struct
 	info.si_uid = tsk->uid;
 
 	/* FIXME: find out whether or not this is supposed to be c*time. */
-	info.si_utime = hz_to_std(tsk->times.tms_utime);
-	info.si_stime = hz_to_std(tsk->times.tms_stime);
+	info.si_utime = jiffies_to_clock_t(tsk->times.tms_utime);
+	info.si_stime = jiffies_to_clock_t(tsk->times.tms_stime);
 
 	status = tsk->exit_code & 0x7f;
 	why = SI_KERNEL;	/* shouldn't happen */
diff -Naurp linux-2.4-ts11/kernel/sys.c linux-2.4-ts11-vhz/kernel/sys.c
--- linux-2.4-ts11/kernel/sys.c	2004-08-04 03:33:52.000000000 +0200
+++ linux-2.4-ts11-vhz/kernel/sys.c	2008-05-21 20:36:16.000000000 +0200
@@ -14,7 +14,7 @@
 #include <linux/prctl.h>
 #include <linux/init.h>
 #include <linux/highuid.h>
-
+#include <asm/param.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -801,7 +801,7 @@ asmlinkage long sys_setfsgid(gid_t gid)
 
 asmlinkage long sys_times(struct tms * tbuf)
 {
-	struct tms temp;
+ 	struct tms temp;
 
 	/*
 	 *	In the SMP world we might just be unlucky and have one of
@@ -810,14 +810,14 @@ asmlinkage long sys_times(struct tms * t
 	 *	as if the syscall took an instant longer to occur.
 	 */
 	if (tbuf) {
-		temp.tms_utime = hz_to_std(current->times.tms_utime);
-		temp.tms_stime = hz_to_std(current->times.tms_stime);
-		temp.tms_cutime = hz_to_std(current->times.tms_cutime);
-		temp.tms_cstime = hz_to_std(current->times.tms_cstime);
+		temp.tms_utime = jiffies_to_clock_t(current->times.tms_utime);
+		temp.tms_stime = jiffies_to_clock_t(current->times.tms_stime);
+		temp.tms_cutime = jiffies_to_clock_t(current->times.tms_cutime);
+		temp.tms_cstime = jiffies_to_clock_t(current->times.tms_cstime);
 		if (copy_to_user(tbuf, &temp, sizeof(struct tms)))
 			return -EFAULT;
 	}
-	return hz_to_std(jiffies);
+	return jiffies_to_clock_t(jiffies);
 }
 
 /*
diff -Naurp linux-2.4-ts11/kernel/timer.c linux-2.4-ts11-vhz/kernel/timer.c
--- linux-2.4-ts11/kernel/timer.c	2004-07-22 21:50:27.000000000 +0200
+++ linux-2.4-ts11-vhz/kernel/timer.c	2008-05-21 20:34:07.000000000 +0200
@@ -430,7 +430,11 @@ static void second_overflow(void)
 	if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
 	    ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;
 	time_offset += ltemp;
-	time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+#if SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE > 0
+    time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+#else
+    time_adj = -ltemp >> (SHIFT_HZ + SHIFT_UPDATE - SHIFT_SCALE);
+#endif
     } else {
 	ltemp = time_offset;
 	if (!(time_status & STA_FLL))
@@ -438,7 +442,11 @@ static void second_overflow(void)
 	if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
 	    ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;
 	time_offset -= ltemp;
-	time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+#if SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE > 0
+    time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+#else
+    time_adj = ltemp >> (SHIFT_HZ + SHIFT_UPDATE - SHIFT_SCALE);
+#endif
     }
 
     /*
