diff options
author | 2010-01-03 19:17:33 +0000 | |
---|---|---|
committer | 2010-01-03 19:17:33 +0000 | |
commit | 8173f95924bf84fd2de562c4293af65d135a7f81 (patch) | |
tree | 2622444306fcca0ae4c67a0db5773406b36a8a6d | |
parent | delete unused variable (diff) | |
download | wireguard-openbsd-8173f95924bf84fd2de562c4293af65d135a7f81.tar.xz wireguard-openbsd-8173f95924bf84fd2de562c4293af65d135a7f81.zip |
Use atomic operations to access the per-cpu scheduler flags.
-rw-r--r-- | sys/kern/sched_bsd.c | 13 |
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(); |