[PATCH] HZ==100 assumptions

Artur Skawina (skawina@geocities.com)
Fri, 23 Jul 1999 05:42:35 +0200


This is a multi-part message in MIME format.

--------------4654363CAA37761816B6A8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

attached patch kills all HZ==100 assumptions i noticed in various
drivers.

--------------4654363CAA37761816B6A8
Content-Type: text/plain; charset=us-ascii; name="100hz"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="100hz"

diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/drivers/cdrom/gscd.c linux-2.3.11as/drivers/cdrom/gscd.c
--- /img/linux-2.3.11/drivers/cdrom/gscd.c Fri Jul 9 03:16:42 1999
+++ linux-2.3.11as/drivers/cdrom/gscd.c Thu Jul 22 22:00:49 1999
@@ -355,7 +355,7 @@ char cmd[] = { CMD_READ, 0x80, 0,0,0,
end_request(1);
}
}
- SET_TIMER(do_gscd_request, 1);
+ SET_TIMER(do_gscd_request, HZ/100);
}


diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/drivers/cdrom/mcd.c linux-2.3.11as/drivers/cdrom/mcd.c
--- /img/linux-2.3.11/drivers/cdrom/mcd.c Fri Jul 9 03:16:42 1999
+++ linux-2.3.11as/drivers/cdrom/mcd.c Thu Jul 22 22:00:49 1999
@@ -674,7 +674,7 @@ do_mcd_request(void)
}
mcd_state = MCD_S_START;
McdTries = 5;
- SET_TIMER(mcd_poll, 1);
+ SET_TIMER(mcd_poll, HZ/100);
}
break;
}
@@ -1069,7 +1069,7 @@ mcd_poll(void)
mcd_state = MCD_S_STOP;
}

- SET_TIMER(mcd_poll, 1);
+ SET_TIMER(mcd_poll, HZ/100);
}


@@ -1364,7 +1364,7 @@ mcdStatTimer(void)
return;
}

- SET_TIMER(mcdStatTimer, 1);
+ SET_TIMER(mcdStatTimer, HZ/100);
}


@@ -1380,7 +1380,7 @@ getMcdStatus(int timeout)
int st;

McdTimeout = timeout;
- SET_TIMER(mcdStatTimer, 1);
+ SET_TIMER(mcdStatTimer, HZ/100);
sleep_on(&mcd_waitq);
if (McdTimeout <= 0)
return -1;
diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/drivers/cdrom/sjcd.c linux-2.3.11as/drivers/cdrom/sjcd.c
--- /img/linux-2.3.11/drivers/cdrom/sjcd.c Fri Jul 9 03:16:42 1999
+++ linux-2.3.11as/drivers/cdrom/sjcd.c Thu Jul 22 22:00:49 1999
@@ -363,7 +363,7 @@ static void sjcd_status_timer( void ){
/*
* We have still some time to wait. Try again.
*/
- SJCD_SET_TIMER( sjcd_status_timer, 1 );
+ SJCD_SET_TIMER( sjcd_status_timer, HZ/100 );
}
}

@@ -373,7 +373,7 @@ static void sjcd_status_timer( void ){
*/
static int sjcd_wait_for_status( void ){
sjcd_status_timeout = SJCD_WAIT_FOR_STATUS_TIMEOUT;
- SJCD_SET_TIMER( sjcd_status_timer, 1 );
+ SJCD_SET_TIMER( sjcd_status_timer, HZ/100 );
sleep_on( &sjcd_waitq );
#if defined( SJCD_DIAGNOSTIC ) || defined ( SJCD_TRACE )
if( sjcd_status_timeout <= 0 )
@@ -1269,7 +1269,7 @@ static void sjcd_poll( void ){
* Get back in some time. 1 should be replaced with count variable to
* avoid unnecessary testings.
*/
- SJCD_SET_TIMER( sjcd_poll, 1 );
+ SJCD_SET_TIMER( sjcd_poll, HZ/100 );
}

static void do_sjcd_request( void ){
diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/drivers/scsi/i91uscsi.c linux-2.3.11as/drivers/scsi/i91uscsi.c
--- /img/linux-2.3.11/drivers/scsi/i91uscsi.c Thu Jan 14 18:31:41 1999
+++ linux-2.3.11as/drivers/scsi/i91uscsi.c Thu Jul 22 22:00:49 1999
@@ -219,7 +219,7 @@ extern int tul_num_ch;

static void tul_do_pause(unsigned amount)
{ /* Pause for amount*10 milliseconds */
- unsigned long the_time = jiffies + amount; /* 0.01 seconds per jiffy */
+ unsigned long the_time = jiffies + (amount*(HZ/100));

#if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95)
while (time_before_eq(jiffies, the_time));
diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/include/asm-i386/bugs.h linux-2.3.11as/include/asm-i386/bugs.h
--- /img/linux-2.3.11/include/asm-i386/bugs.h Fri Jul 9 03:19:56 1999
+++ linux-2.3.11as/include/asm-i386/bugs.h Thu Jul 22 22:00:49 1999
@@ -44,7 +44,7 @@ static char __initdata fpu_error = 0;
__initfunc(static void copro_timeout(void))
{
fpu_error = 1;
- timer_table[COPRO_TIMER].expires = jiffies+100;
+ timer_table[COPRO_TIMER].expires = jiffies+HZ;
timer_active |= 1<<COPRO_TIMER;
printk(KERN_ERR "387 failed: trying to reset\n");
send_sig(SIGFPE, current, 1);
@@ -102,7 +102,7 @@ __initfunc(static void check_fpu(void))
* should get there first..
*/
printk(KERN_INFO "Checking 386/387 coupling... ");
- timer_table[COPRO_TIMER].expires = jiffies+50;
+ timer_table[COPRO_TIMER].expires = jiffies+HZ/2;
timer_table[COPRO_TIMER].fn = copro_timeout;
timer_active |= 1<<COPRO_TIMER;
__asm__("clts ; fninit ; fnstcw %0 ; fwait":"=m" (*&control_word));
diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/include/linux/arcdevice.h linux-2.3.11as/include/linux/arcdevice.h
--- /img/linux-2.3.11/include/linux/arcdevice.h Tue Dec 29 19:18:18 1998
+++ linux-2.3.11as/include/linux/arcdevice.h Thu Jul 22 22:00:49 1999
@@ -69,7 +69,7 @@
* increased. The larger it is, though, the longer it will be between
* necessary transmits - don't set this too large.
*/
-#define TX_TIMEOUT 20
+#define TX_TIMEOUT (20*HZ/100)


/* Display warnings about the driver being an ALPHA version.
diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/include/linux/lp.h linux-2.3.11as/include/linux/lp.h
--- /img/linux-2.3.11/include/linux/lp.h Fri Jul 9 03:16:48 1999
+++ linux-2.3.11as/include/linux/lp.h Thu Jul 22 22:00:49 1999
@@ -78,7 +78,7 @@
#endif
#define LPGETFLAGS 0x060e /* get status flags */

-/* timeout for printk'ing a timeout, in jiffies (100ths of a second).
+/* timeout for printk'ing a timeout, in jiffies.
This is also used for re-checking error conditions if LP_ABORT is
not set. This is the default behavior. */

diff -urNp --exclude-from /usr/src/lkdontdiff /img/linux-2.3.11/include/net/br.h linux-2.3.11as/include/net/br.h
--- /img/linux-2.3.11/include/net/br.h Sun Mar 7 23:25:23 1999
+++ linux-2.3.11as/include/net/br.h Thu Jul 22 22:00:49 1999
@@ -42,7 +42,7 @@

/* broacast/multicast storm limitation. This per source. */
#define MAX_MCAST_PER_PERIOD 4
-#define MCAST_HOLD_TIME 10 /* in jiffies unit (10ms increment) */
+#define MCAST_HOLD_TIME (10*HZ/100)

#define Default_path_cost 10

--------------4654363CAA37761816B6A8--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/