summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-01-03 19:17:34 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-01-03 19:17:34 +0000
commitec2ee9d9de758bf9bf150610999d3c8360752d32 (patch)
treecce39b7a757146baae9b69b7f5cc77a8108adf82 /sys/kern
parent8dbb1192d077b6b9cc92dd4db8cb51421217ca13 (diff)
Use atomic operations to access the per-cpu scheduler flags.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/sched_bsd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index 2c4e7c6caa0..d6a7d253d0e 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.21 2009/04/14 09:13:25 art Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.22 2010/01/03 19:17:33 kettenis Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -93,23 +93,22 @@ void
roundrobin(struct cpu_info *ci)
{
struct schedstate_percpu *spc = &ci->ci_schedstate;
- int s;
spc->spc_rrticks = rrticks_init;
if (ci->ci_curproc != NULL) {
- s = splstatclock();
if (spc->spc_schedflags & SPCF_SEENRR) {
/*
* The process has already been through a roundrobin
* without switching and may be hogging the CPU.
* Indicate that the process should yield.
*/
- spc->spc_schedflags |= SPCF_SHOULDYIELD;
+ atomic_setbits_int(&spc->spc_schedflags,
+ SPCF_SHOULDYIELD);
} else {
- spc->spc_schedflags |= SPCF_SEENRR;
+ atomic_setbits_int(&spc->spc_schedflags,
+ SPCF_SEENRR);
}
- splx(s);
}
if (spc->spc_nrun)
@@ -406,7 +405,7 @@ mi_switch(void)
* Process is about to yield the CPU; clear the appropriate
* scheduling flags.
*/
- spc->spc_schedflags &= ~SPCF_SWITCHCLEAR;
+ atomic_clearbits_int(&spc->spc_schedflags, SPCF_SWITCHCLEAR);
nextproc = sched_chooseproc();