summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-05-18 14:41:56 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-05-18 14:41:56 +0000
commitc8091cffb315d5e42a67e8aab8dcaf87784df055 (patch)
treecb83d3945bcc46180dffe28c87c528f9ce4bdae7
parent21fcb8f3eb3e0c57daee39d46888aca33b0033ad (diff)
Instead of checking whichqs directly, add a "sched_is_idle()" macro to
sys/sched.h and use that to check if there's something to do. kettenis@ thib@ ok
-rw-r--r--sys/arch/amd64/amd64/pmap.c5
-rw-r--r--sys/arch/arm/arm/pmap.c5
-rw-r--r--sys/arch/sh/sh/locore_c.c4
-rw-r--r--sys/sys/sched.h4
-rw-r--r--sys/uvm/uvm_page.c4
5 files changed, 13 insertions, 9 deletions
diff --git a/sys/arch/amd64/amd64/pmap.c b/sys/arch/amd64/amd64/pmap.c
index df7488d00d0..a6fb4ceb6b4 100644
--- a/sys/arch/amd64/amd64/pmap.c
+++ b/sys/arch/amd64/amd64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.21 2007/05/15 16:38:33 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.22 2007/05/18 14:41:55 art Exp $ */
/* $NetBSD: pmap.c,v 1.3 2003/05/08 18:13:13 thorpej Exp $ */
/*
@@ -116,6 +116,7 @@
#include <sys/user.h>
#include <sys/kernel.h>
#include <sys/mutex.h>
+#include <sys/sched.h>
#include <uvm/uvm.h>
@@ -1574,7 +1575,7 @@ pmap_pageidlezero(struct vm_page *pg)
* with uncached mappings.
*/
for (i = 0, ptr = (long *) va; i < PAGE_SIZE / sizeof(long); i++) {
- if (whichqs != 0) {
+ if (!sched_is_idle()) {
/*
* A process has become ready. Abort now,
diff --git a/sys/arch/arm/arm/pmap.c b/sys/arch/arm/arm/pmap.c
index ad4e211ff98..b19bce07a63 100644
--- a/sys/arch/arm/arm/pmap.c
+++ b/sys/arch/arm/arm/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.12 2007/04/21 19:26:03 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.13 2007/05/18 14:41:55 art Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -198,6 +198,7 @@
#include <sys/user.h>
#include <sys/pool.h>
#include <sys/cdefs.h>
+#include <sys/sched.h>
#include <uvm/uvm.h>
@@ -3340,7 +3341,7 @@ pmap_pageidlezero(struct vm_page *pg)
for (i = 0, ptr = (int *)cdstp;
i < (PAGE_SIZE / sizeof(int)); i++) {
- if (whichqs != 0) {
+ if (!sched_is_idle()) {
/*
* A process has become ready. Abort now,
* so we don't keep it waiting while we
diff --git a/sys/arch/sh/sh/locore_c.c b/sys/arch/sh/sh/locore_c.c
index f90d554bde8..cb59d66512e 100644
--- a/sys/arch/sh/sh/locore_c.c
+++ b/sys/arch/sh/sh/locore_c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore_c.c,v 1.3 2006/12/14 14:56:23 kettenis Exp $ */
+/* $OpenBSD: locore_c.c,v 1.4 2007/05/18 14:41:55 art Exp $ */
/* $NetBSD: locore_c.c,v 1.13 2006/03/04 01:13:35 uwe Exp $ */
/*-
@@ -186,7 +186,7 @@ cpu_switch_search(struct proc *oproc)
curproc = NULL;
SCHED_LOCK_IDLE();
- while (whichqs == 0) {
+ while (sched_is_idle()) {
SCHED_UNLOCK_IDLE();
idle();
SCHED_LOCK_IDLE();
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 7f35dc91ada..407ec09f651 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched.h,v 1.15 2007/05/16 17:27:31 art Exp $ */
+/* $OpenBSD: sched.h,v 1.16 2007/05/18 14:41:55 art Exp $ */
/* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */
/*-
@@ -126,6 +126,8 @@ void schedclock(struct proc *);
struct cpu_info;
void roundrobin(struct cpu_info *);
+#define sched_is_idle() (whichqs == 0)
+
/* Inherit the parent's scheduler history */
#define scheduler_fork_hook(parent, child) do { \
(child)->p_estcpu = (parent)->p_estcpu; \
diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c
index 0ef257dad2d..2caca1ba938 100644
--- a/sys/uvm/uvm_page.c
+++ b/sys/uvm/uvm_page.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_page.c,v 1.59 2007/04/13 18:57:49 art Exp $ */
+/* $OpenBSD: uvm_page.c,v 1.60 2007/05/18 14:41:55 art Exp $ */
/* $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $ */
/*
@@ -1397,5 +1397,5 @@ uvm_pageidlezero()
uvmexp.free++;
uvmexp.zeropages++;
uvm_unlock_fpageq(s);
- } while (whichqs == 0);
+ } while (sched_is_idle());
}