diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2007-05-18 16:10:16 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2007-05-18 16:10:16 +0000 |
commit | a15e9ff6481611766ed71b5425d88d7bc7aaf4bc (patch) | |
tree | 1978623290fc9d393ed6c091bae0e7ad0389fab4 /sys | |
parent | 559b607f801597fe94f99f4a7b95c4a6f84854f7 (diff) |
Widen the SCHED_LOCK in two cases to protect p_estcpu and p_priority.
kettenis@ ok
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sched_bsd.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c index 186be456346..047207b1d39 100644 --- a/sys/kern/sched_bsd.c +++ b/sys/kern/sched_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sched_bsd.c,v 1.11 2007/05/16 17:27:30 art Exp $ */ +/* $OpenBSD: sched_bsd.c,v 1.12 2007/05/18 16:10:15 art Exp $ */ /* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */ /*- @@ -241,7 +241,7 @@ schedcpu(void *arg) */ if (p->p_slptime > 1) continue; - s = splstatclock(); /* prevent state changes */ + SCHED_LOCK(s); /* * p_pctcpu is only for ps. */ @@ -257,8 +257,6 @@ schedcpu(void *arg) p->p_cpticks = 0; newcpu = (u_int) decay_cpu(loadfac, p->p_estcpu); p->p_estcpu = newcpu; - splx(s); - SCHED_LOCK(s); resetpriority(p); if (p->p_priority >= PUSER) { if ((p != curproc) && @@ -585,10 +583,10 @@ schedclock(struct proc *p) { int s; - p->p_estcpu = ESTCPULIM(p->p_estcpu + 1); SCHED_LOCK(s); + p->p_estcpu = ESTCPULIM(p->p_estcpu + 1); resetpriority(p); - SCHED_UNLOCK(s); if (p->p_priority >= PUSER) p->p_priority = p->p_usrpri; + SCHED_UNLOCK(s); } |