Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Implement yield()/preempt() now th...
details: https://anonhg.NetBSD.org/src/rev/7d9d1f0552ba
branches: trunk
changeset: 748754:7d9d1f0552ba
user: pooka <pooka%NetBSD.org@localhost>
date: Wed Nov 04 18:11:11 2009 +0000
description:
Implement yield()/preempt() now that there is a CPU scheduler.
diffstat:
sys/rump/librump/rumpkern/misc_stub.c | 23 ++---------------------
sys/rump/librump/rumpkern/scheduler.c | 24 ++++++++++++++++++++++--
2 files changed, 24 insertions(+), 23 deletions(-)
diffs (86 lines):
diff -r d664edf18702 -r 7d9d1f0552ba sys/rump/librump/rumpkern/misc_stub.c
--- a/sys/rump/librump/rumpkern/misc_stub.c Wed Nov 04 17:03:52 2009 +0000
+++ b/sys/rump/librump/rumpkern/misc_stub.c Wed Nov 04 18:11:11 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: misc_stub.c,v 1.24 2009/10/15 00:28:46 pooka Exp $ */
+/* $NetBSD: misc_stub.c,v 1.25 2009/11/04 18:11:11 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: misc_stub.c,v 1.24 2009/10/15 00:28:46 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: misc_stub.c,v 1.25 2009/11/04 18:11:11 pooka Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -49,25 +49,6 @@
int nbpg = 4096;
#endif
-void
-yield(void)
-{
-
- /*
- * Do nothing - doesn't really make sense as we're being
- * scheduled anyway.
- */
- return;
-}
-
-void
-preempt(void)
-{
-
- /* see yield */
- return;
-}
-
int
syscall_establish(const struct emul *em, const struct syscall_package *sp)
{
diff -r d664edf18702 -r 7d9d1f0552ba sys/rump/librump/rumpkern/scheduler.c
--- a/sys/rump/librump/rumpkern/scheduler.c Wed Nov 04 17:03:52 2009 +0000
+++ b/sys/rump/librump/rumpkern/scheduler.c Wed Nov 04 18:11:11 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scheduler.c,v 1.4 2009/10/16 00:14:53 pooka Exp $ */
+/* $NetBSD: scheduler.c,v 1.5 2009/11/04 18:11:11 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.4 2009/10/16 00:14:53 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.5 2009/11/04 18:11:11 pooka Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -169,3 +169,23 @@
rumpuser_cv_signal(schedcv);
rumpuser_mutex_exit(schedmtx);
}
+
+/* Give up and retake CPU (perhaps a different one) */
+void
+yield()
+{
+ struct lwp *l = curlwp;
+ int nlocks;
+
+ KERNEL_UNLOCK_ALL(l, &nlocks);
+ rump_unschedule_cpu(l);
+ rump_schedule_cpu(l);
+ KERNEL_LOCK(nlocks, l);
+}
+
+void
+preempt()
+{
+
+ yield();
+}
Home |
Main Index |
Thread Index |
Old Index