Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 avoid divide by zero when setting '...



details:   https://anonhg.NetBSD.org/src/rev/2ccdf8278d1f
branches:  trunk
changeset: 329025:2ccdf8278d1f
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Apr 30 00:09:29 2014 +0000

description:
avoid divide by zero when setting 'hz' low.

diffstat:

 sys/arch/sparc64/sparc64/clock.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r c99b9713e8ba -r 2ccdf8278d1f sys/arch/sparc64/sparc64/clock.c
--- a/sys/arch/sparc64/sparc64/clock.c  Tue Apr 29 23:18:53 2014 +0000
+++ b/sys/arch/sparc64/sparc64/clock.c  Wed Apr 30 00:09:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.114 2013/12/07 11:17:25 nakayama Exp $ */
+/*     $NetBSD: clock.c,v 1.115 2014/04/30 00:09:29 mrg Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.114 2013/12/07 11:17:25 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.115 2014/04/30 00:09:29 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -556,7 +556,10 @@
         * Establish scheduler softint.
         */
        schedint = sparc_softintr_establish(PIL_SCHED, schedintr, NULL);
-       schedhz = 16;   /* 16Hz is best according to kern/kern_clock.c */
+       if (stathz > 60)
+               schedhz = 16;   /* 16Hz is best according to kern/kern_clock.c */
+       else
+               schedhz = stathz / 2 + 1;
        statscheddiv = stathz / schedhz;
        if (statscheddiv <= 0)
                panic("statscheddiv");



Home | Main Index | Thread Index | Old Index