diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2007-10-10 16:21:30 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2007-10-10 16:21:30 +0000 |
commit | 36cb4fc0487dfc4950cea57314bdf46d633a3837 (patch) | |
tree | f7bce7f9cb39b69a2e0ca2787d5e699e9b8b6b13 /share | |
parent | 34a10db410c05d1421bdbf35a4eb4a440ca96bad (diff) |
Update to match cpu_switchto reality.
Diffstat (limited to 'share')
-rw-r--r-- | share/man/man9/Makefile | 4 | ||||
-rw-r--r-- | share/man/man9/ctxsw.9 | 53 |
2 files changed, 15 insertions, 42 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 65e2cc13ff8..cb616611478 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.131 2007/10/02 17:29:44 cnst Exp $ +# $OpenBSD: Makefile,v 1.132 2007/10/10 16:21:29 art Exp $ # $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -112,7 +112,7 @@ MLINKS+=crypto.9 crypto_register.9 \ crypto.9 crypto_kdispatch.9 \ crypto.9 crypto_getreq.9 \ crypto.9 crypto_freereq.9 -MLINKS+=ctxsw.9 cpu_switch.9 ctxsw.9 mi_switch.9 +MLINKS+=ctxsw.9 cpu_switchto.9 ctxsw.9 mi_switch.9 MLINKS+=disk.9 disk_init.9 disk.9 disk_attach.9 disk.9 disk_detatch.9 \ disk.9 disk_busy.9 disk.9 disk_unbusy.9 MLINKS+=disklabel.9 readdisklabel.9 disklabel.9 writedisklabel.9 \ diff --git a/share/man/man9/ctxsw.9 b/share/man/man9/ctxsw.9 index 5e48791e9e0..acbaad0a17e 100644 --- a/share/man/man9/ctxsw.9 +++ b/share/man/man9/ctxsw.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ctxsw.9,v 1.12 2007/09/14 16:16:08 mk Exp $ +.\" $OpenBSD: ctxsw.9,v 1.13 2007/10/10 16:21:29 art Exp $ .\" $NetBSD: ctxsw.9,v 1.9 1999/03/06 22:09:29 mycroft Exp $ .\" .\" Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -35,12 +35,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: September 14 2007 $ +.Dd $Mdocdate: October 10 2007 $ .Dt CTXSW 9 .Os .Sh NAME .Nm mi_switch , -.Nm cpu_switch +.Nm cpu_switchto .Nd switch to another process context .Sh SYNOPSIS .Fd #include <sys/param.h> @@ -48,7 +48,7 @@ .Ft void .Fn mi_switch "void" .Ft void -.Fn cpu_switch "void" +.Fn cpu_switchto "struct proc *old" "struct proc *new" .Sh DESCRIPTION The .Fn mi_switch @@ -96,49 +96,22 @@ For a process which accumulated longer than 10 minutes of CPU time, its nice level is raised to 4. After these administrative tasks are done, .Fn mi_switch -hands over control to the machine dependent routine -.Fn cpu_switch "void" , +chooses the next process to run and hands over control to the machine +dependent routine +.Fn cpu_switchto , which will perform the actual process context switch. .Pp -.Fn cpu_switch -will make a choice amongst the processes which are ready to run from a -priority queue data-structure. -The priority queue consists of an array -.Va qs[NQS] -of queue header structures each of which identifies a list of runnable -processes of equal priority -.Pq see Aq Pa sys/proc.h . -A single word -.Va whichqs -containing a bit mask identifying non-empty queues assists in selecting -a process quickly. -.Fn cpu_switch -must remove the first process from the list on the queue -with the highest priority -(lower indices in -.Va qs -indicate higher priority), -and assign the address of its process structure to the global variable -.Va curproc . -If no processes are available on the run queues, -.Fn cpu_switch -shall go into an -.Dq idle -loop. -The idle loop must allow interrupts to be taken that will eventually cause -processes to appear again on the run queues. -The variable -.Va curproc -should be +.Fn cpu_switchto +will save the context of the old process and switch to the new one. +A special case is when the old process is .Dv NULL -while -.Fn cpu_switch -waits for this to happen. +which means that the old process has exited and doesn't need to be +saved. .Pp Note that .Fn mi_switch and thus -.Fn cpu_switch +.Fn cpu_switchto should be called at .Xr splhigh 9 . .Sh SEE ALSO |