aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1997-08-18 01:34:38 +0000
committerJulian Elischer <julian@FreeBSD.org>1997-08-18 01:34:38 +0000
commitff36905c57375bd7d1f306c65ccb037c5b6c60ff (patch)
treeeec52cfe285e0436bcd39175e90b99276408e565 /sys/kern
parent2eb0f66483fdbff481db7ed5d489fc3a7947ed65 (diff)
downloadsrc-ff36905c57375bd7d1f306c65ccb037c5b6c60ff.tar.gz
src-ff36905c57375bd7d1f306c65ccb037c5b6c60ff.zip
Take verbal beating by wollman into account and fix DIAGNOSTIC test.
This version. 1/ avoids garret's introduced potential page fault. (I got one) 2/ removes compiler warnings Also fix the tunable scheduling quantum to return a better error code when fed a bad argument.
Notes
Notes: svn path=/head/; revision=28342
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_synch.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index 2126425f3e86..17d5db4e41f3 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_synch.c 8.9 (Berkeley) 5/19/95
- * $Id: kern_synch.c,v 1.34 1997/08/13 19:29:33 julian Exp $
+ * $Id: kern_synch.c,v 1.35 1997/08/16 19:07:20 wollman Exp $
*/
#include "opt_ktrace.h"
@@ -84,8 +84,12 @@ sysctl_kern_quantum SYSCTL_HANDLER_ARGS
new_val = quantum;
error = sysctl_handle_int(oidp, &new_val, 0, req);
- if ((error == 0) && (new_val > 0) && (new_val < MAXIMUM_SCHEDULE_QUANTUM)) {
- quantum = new_val;
+ if (error == 0) {
+ if ((new_val > 0) && (new_val < MAXIMUM_SCHEDULE_QUANTUM)) {
+ quantum = new_val;
+ } else {
+ error = EINVAL;
+ }
}
return (error);
}
@@ -201,7 +205,7 @@ schedcpu(arg)
{
register fixpt_t loadfac = loadfactor(averunnable.ldavg[0]);
register struct proc *p;
- register int s, i, j;
+ register int s;
register unsigned int newcpu;
wakeup((caddr_t)&lbolt);
@@ -254,7 +258,6 @@ schedcpu(arg)
p->p_priority = p->p_usrpri;
}
splx(s);
- not_mine:
}
vmmeter();
timeout(schedcpu, (void *)0, hz);
@@ -354,12 +357,8 @@ tsleep(ident, priority, wmesg, timo)
if (ident == NULL || p->p_stat != SRUN)
panic("tsleep");
/* XXX This is not exhaustive, just the most common case */
- if ((p->p_procq.tqe_next != NULL)
-#if 0 /* XXX this is impossible... the types don't even match */
- && (p->p_procq.tqe_next == p->p_procq.tqe_prev)
-#endif
- && (*p->p_procq.tqe_prev == p))
- panic("sleeping process on run queue");
+ if ((p->p_procq.tqe_prev != NULL) && (*p->p_procq.tqe_prev == p))
+ panic("sleeping process already on another queue");
#endif
p->p_wchan = ident;
p->p_wmesg = wmesg;