Module Name: src Committed By: pooka Date: Wed Nov 4 18:11:11 UTC 2009
Modified Files: src/sys/rump/librump/rumpkern: misc_stub.c scheduler.c Log Message: Implement yield()/preempt() now that there is a CPU scheduler. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/rump/librump/rumpkern/misc_stub.c cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/scheduler.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/rump/librump/rumpkern/misc_stub.c diff -u src/sys/rump/librump/rumpkern/misc_stub.c:1.24 src/sys/rump/librump/rumpkern/misc_stub.c:1.25 --- src/sys/rump/librump/rumpkern/misc_stub.c:1.24 Thu Oct 15 00:28:46 2009 +++ src/sys/rump/librump/rumpkern/misc_stub.c Wed Nov 4 18:11:11 2009 @@ -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) { Index: src/sys/rump/librump/rumpkern/scheduler.c diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.4 src/sys/rump/librump/rumpkern/scheduler.c:1.5 --- src/sys/rump/librump/rumpkern/scheduler.c:1.4 Fri Oct 16 00:14:53 2009 +++ src/sys/rump/librump/rumpkern/scheduler.c Wed Nov 4 18:11:11 2009 @@ -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(); +}