summaryrefslogtreecommitdiff
path: root/sys/kern/kern_subr.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-04-19 09:58:21 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-04-19 09:58:21 +0000
commit1eb85a579a0d9030c50d66f0327dee8387ccf303 (patch)
treede76153b3fd63ba73b6b358f5ff3f88c5deda1c2 /sys/kern/kern_subr.c
parentc5af69f27d7fb2fb195805f354bb466926706ff7 (diff)
Remove the roundrobin_attempts hack and replace it with per-process scheduling
flags (much nicer for future smp work). Add two generic functions yield() and preempt(). Use preepmt() in uio when we are told to yield. Based on my idea, code written by Jason Thorpe from NetBSD.
Diffstat (limited to 'sys/kern/kern_subr.c')
-rw-r--r--sys/kern/kern_subr.c24
1 files changed, 3 insertions, 21 deletions
diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c
index 7c7550b9861..59a1ebc0d06 100644
--- a/sys/kern/kern_subr.c
+++ b/sys/kern/kern_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_subr.c,v 1.11 2000/03/03 16:58:49 art Exp $ */
+/* $OpenBSD: kern_subr.c,v 1.12 2000/04/19 09:58:20 art Exp $ */
/* $NetBSD: kern_subr.c,v 1.15 1996/04/09 17:21:56 ragge Exp $ */
/*
@@ -49,10 +49,6 @@
#include <sys/kernel.h>
#include <sys/resourcevar.h>
-void uio_yield __P((struct proc *));
-
-#define UIO_NEED_YIELD (roundrobin_attempts >= 2)
-
int
uiomove(cp, n, uio)
register caddr_t cp;
@@ -85,8 +81,8 @@ uiomove(cp, n, uio)
switch (uio->uio_segflg) {
case UIO_USERSPACE:
- if (UIO_NEED_YIELD)
- uio_yield(p);
+ if (p->p_schedflags & PSCHED_SHOULDYIELD)
+ preempt(NULL);
if (uio->uio_rw == UIO_READ)
error = copyout(cp, iov->iov_base, cnt);
else
@@ -168,20 +164,6 @@ again:
return (0);
}
-void
-uio_yield(p)
- struct proc *p;
-{
- int s;
-
- p->p_priority = p->p_usrpri;
- s = splstatclock();
- setrunqueue(p);
- p->p_stats->p_ru.ru_nivcsw++;
- mi_switch();
- splx(s);
-}
-
/*
* General routine to allocate a hash table.
*/