Document some of the kernel vm_page API as well as the pbuf API.

Submitted by: Chad David <davidc@acns.ab.ca>
This commit is contained in:
alfred 2001-07-18 06:09:13 +00:00
parent 27eac06362
commit 8ca85b43c8
14 changed files with 1016 additions and 0 deletions

124
share/man/man9/pbuf.9 Normal file
View File

@ -0,0 +1,124 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 9, 2001
.Dt PBUF 9
.Os
.Sh NAME
.Nm pbuf ,
.Nm getpbuf ,
.Nm trypbuf ,
.Nm relpbuf
.Nd "functions for managing physical buffers"
.Sh SYNOPSIS
.In sys/param.h
.In sys/systm.h
.In sys/bio.h
.In sys/buf.h
.Ft "struct buf *"
.Fn getpbuf "int *pfreecnt"
.Ft "struct buf *"
.Fn trypbuf "int *pfreecnt"
.Ft void
.Fn relpbuf "struct buf *bp" "int *pfreecnt"
.Sh DESCRIPTION
These functions are used to allocate and release physical buffers.
Each subsystem that allocates buffers via these calls is expected
to manage its own percentage free counter.
If the value is initialized to \-1 the number of buffers available
to the subsystem is limited only by the number of physical buffers
available.
The number of buffers is stored in
.Va nswbuf
which is defined in
.Pa sys/buf.h
and initialized in
.Fn cpu_startup .
A recommended initialization value is 1/2
.Va nswbuf .
.Pp
The
.Fn getpbuf
function returns the first available buffer to the user.
If there are no buffers available,
.Fn getpbuf
will sleep waiting for one to become available.
If
.Fa pfreecnt
is zero,
.Fn getpbuf
will sleep until it increases.
.Fa pfreecnt
is decremented prior to returning.
.Pp
The
.Fn trypbuf
function returns the first available buffer.
If there are no buffers available,
.Dv NULL
is returned.
As well, if
.Fa pfreecnt
is zero,
.Dv NULL
is returned.
.Fa pfreecnt
is decremented prior to returning a valid buffer.
If
.Dv NULL
is returned,
.Fa pfreecnt
is not modified.
.Pp
The
.Fn relpbuf
function releases the buffer back to the free list.
If the buffers
.Va b_rcred
or
.Va b_wcred
structures are not
.Dv NULL ,
they are freed.
See
.Xr crfree 9 .
.Pp
.Fa pfreecnt
is incremented prior to returning.
.Sh RETURN VALUES
.Fn getpbuf
and
.Fn trypbuf
return a pointer to the buffer.
In the case of
.Fn trypbuf ,
.Dv NULL
can also be returned indicating that there are no buffers available.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,98 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_ALLOC 9
.Os
.Sh NAME
.Nm vm_page_alloc
.Nd "allocates a page for the object and index"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft vm_page_t
.Fn vm_page_alloc "vm_object_t object" "vm_pindex_t pindex" "int page_req"
.Sh DESCRIPTION
The
.Fn vm_page_alloc
function allocates a page for
.Fa pindex
in the VM object
.Fa object .
It is assumed that a page has not already been allocated for
.Fa pindex
and
.Fa object .
.Pp
The
.Fn vm_page_alloc
function will not block.
.Pp
Its arguments are:
.Bl -tag -width ".Fa page_req"
.It Fa object
The VM object to allocate the page for.
.It Fa pindex
The index of the page that should be allocated.
.It Fa page_req
A flag indicating how the page should be allocated.
.Bl -tag -width ".Dv VM_ALLOC_INTERRUPT"
.It Dv VM_ALLOC_NORMAL
The page should be allocated with no special treatment.
.It Dv VM_ALLOC_SYSTEM
The page can be allocated even if the buffer cache queue is empty
and the free count is above the interrupt reserved water mark.
This should be used only when the system really needs the page.
.It Dv VM_ALLOC_INTERRUPT
.Fn vm_page_alloc
is being called during an interrupt and therefore the cache cannot
be accessed.
The page will only be returned successfully if the free count is greater
than zero.
.It Dv VM_ALLOC_ZERO
The same as
.Dv VM_ALLOC_NORMAL
except the page returned is zeroed.
.El
.El
.Sh RETURN VALUES
A
.Vt vm_page_t
is returned if successful; otherwise,
.Dv NULL
is returned.
.Sh NOTES
The pager process is always upgraded to
.Dv VM_ALLOC_SYSTEM
unless
.Dv VM_ALLOC_INTERRUPT
is set.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,54 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_COPY 9
.Os
.Sh NAME
.Nm vm_page_copy
.Nd "copy a page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_copy "vm_page_t src_m" "vm_page_t dst_m"
.Sh DESCRIPTION
The
.Fn vm_page_copy
function copies the contents of
.Fa src_m
into
.Fa dst_m .
.Pp
The entire contents of
.Fa dst_m
are marked as valid.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,63 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 14, 2001
.Dt VM_PAGE_FLAG 9
.Os
.Sh NAME
.Nm vm_page_flag ,
.Nm vm_page_clear ,
.Nm vm_page_flag_set
.Nd "changes page flags"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_flag_clear "vm_page_t m" "unsigned short bits"
.Ft void
.Fn vm_page_flag_set "vm_page_t m" "unsigned short bits"
.Sh DESCRIPTION
The
.Fn vm_page_flag_clear
atomically clears the specified bits on the page's flags.
.Pp
The
.Fn vm_page_flag_set
atomically sets the specified bits on the page's flags.
.Pp
The functions arguments are:
.Bl -tag -width ".Fa bits"
.It m
The page whose flags are updated.
.It bits
The bits that are set or cleared on the page's flags.
.El
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,64 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_HOLD 9
.Os
.Sh NAME
.Nm vm_page_hold ,
.Nm vm_page_unhold
.Nd "updates a pages hold count"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_hold "vm_page_t m"
.Ft void
.Fn vm_page_unhold "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_hold
function increases the hold count on a page.
This prevents the page daemon from freeing the page.
.Fn vm_page_hold
should only be used for very temporary wiring of a page.
If the page needs to be held for a longer period
.Fn vm_page_write
should be used.
.Pp
.Fn vm_page_unhold
function reduces the hold count on a page.
If the hold count is zero it is possible the page will be freed by the
page daemon.
.Sh SEE ALSO
.Xr vm_page_wire 9
.Xr wm_page_unwire 9
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,91 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_INSERT 9
.Os
.Sh NAME
.Nm vm_page_insert ,
.Nm vm_page_remove
.Nd "add and remove pages from an object"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_insert "vm_page_t m" "vm_object_t object" "vm_pindex_t pindex"
.Ft void
.Fn vm_page_remove "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_insert
function adds a page to the given object at the given index.
The page is added to both the VM page hash table and to the
object's list of pages, but the page tables are not updated.
In the case of a user page, it will be faulted in when it is
accessed.
If the page is a kernel page the caller is expected to
handle adding the page to the kernels pmap.
.Pp
If
.Dv PG_WRITEABLE
is set in the page's flags
.Dv OBJ_WRITEABLE
and
.Dv OBJ_MIGHTBEDIRTY
are set in the object's flags.
.Pp
The
.Fn vm_page_remove
function removes the given page from it's object, and from the
VM page hash table.
The page must be busy prior to this call or the system will panic.
The pmap entry for the page is not removed by this function.
.Pp
The arguments to
.Fn vm_page_insert
are:
.Bl -tag -width ".Fa object
.It m
The page to add to the object.
.It object
The object the page should be added to.
.It pindex
The index into the object the page should be at.
.El
.Pp
The arguments to
.Fn vm_page_remove
are:
.Bl -tag -width ".Fa m"
.It m
The page to remove.
.El
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,59 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_IO_START 9
.Os
.Sh NAME
.Nm vm_page_io_start ,
.Nm vm_page_io_finished
.Nd "ready or unready a page for I/O"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_io_start "vm_page_t m"
.Ft void
.Fn vm_page_io_finised "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_io_start
function prepares the page for I/O by incrementing its busy flag by 1.
.Pp
The
.Fn vm_page_io_finished
function lowers the busy count on the page by one, if the resulting busy
count is zero, a wakeup will be issued if the page has been marked PG_WANTED.
A page is typically marked PG_WANTED by a thread to register interested in
the page either completing I/O or becoming available for general use.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca ,
and
.An Alfred Perlstein Aq alfred@freebsd.org .

View File

@ -0,0 +1,63 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_LOOKUP 9
.Os
.Sh NAME
.Nm vm_page_lookup
.Nd "lookup a vm page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft vm_page_t
.Fn vm_page_lookup "vm_object_t object" "vm_pindex_t pindex"
.Sh DESCRIPTION
The
.Fn vm_page_lookup
function searches for a VM page given its VM object and index.
If the page is not found,
.Dv NULL
is returned.
Its arguments are:
.Bl -tag -width ".Fa object"
.It Fa object
The VM object to search on.
.It Fa pindex
The page index to search on.
.El
.Sh RETURN VALUES
A
.Vt vm_page_t
is returned if successful; otherwise,
.Dv NULL
is returned.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,74 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 14, 2001
.Dt VM_PAGE_PROTECT 9
.Os
.Sh NAME
.Nm vm_page_protect
.Nd "lower a page's protection"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_protect "vm_page_t mem" "int prot"
.Sh DESCRIPTION
The
.Fn vm_page_protect
function lowers a page's protection.
The protection is never raised by this function; therefore, if the page is
already at
.Dv VM_PROT_NONE
the functions does nothing.
.Pp
Its arguments are:
.Bl -tag -width ".Fa prot"
.It mem
The page whose protection is lowered.
.It prot
The protection the page should be reduced to.
If
.Dv VM_PROT_NONE
is specified then the
.Dv PG_WRITABLE
and
.Dv PG_MAPPED
flags are cleared and the pmap_page's protection is set to
.Dv VM_PROT_NONE .
If
.Dv VM_PROT_READ
is specified then the
.Dv PG_WRITABLE
flag is cleared and the pmap_page's protection is set to
.Dv VM_PROT_READ .
.El
Higher protection requests are ignored.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,68 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_SLEEP_BUSY 9
.Os
.Sh NAME
.Nm vm_page_sleep_busy
.Nd "wait for a busy page to become unbusy"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft int
.Fn vm_page_sleep_busy "vm_page_t m" "int also_m_busy" "const char *wmesg"
.Sh DESCRIPTION
The
.Fn vm_page_sleep_busy
function waits until the
.Dv PG_BUSY
flag is cleared.
If
.Fa also_m_busy
is non-zero, it also waits for
.Fa m->busy
to become zero.
.Sh RETURN VALUES
If
.Fn vm_page_sleep_busy
finds the page busy it returns
.Dv TRUE .
If not, it returns
.Dv FALSE .
Returning
.Dv TRUE
does not necessary mean that
.Fn vm_page_sleep_busy
slept, but only that
.Fn splvm
was called.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,76 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 14, 2001
.Dt VM_PAGE_BUSY 9
.Os
.Sh NAME
.Nm vm_page_busy ,
.Nm vm_page_flash ,
.Nm vm_page_wakeup
.Nd "handle the busying and unbusying of a page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_busy "vm_page_t m"
.Ft void
.Fn vm_page_flash "vm_page_t m"
.Ft void
.Fn vm_page_wakeup "vm_page_t m"
.Sh DESCRIPTION
These functions handle the busying, unbusying and notification of the unbusying
of a page.
.Pp
.Fn vm_page_busy
sets the
.Dv PG_BUSY
flag in the page.
.Pp
.Fn vm_page_flash
checks to see if there is anybody waiting on the page
.Dv ( PG_WANTED
will be set), and if so, clears the
.Dv PG_WANTED
flag and notifies whoever is waiting via
.Fn wakeup .
.Pp
.Fn vm_page_wakeup
clears the
.Dv PG_BUSY
flag on the page, and calls
.Fn vm_page_flash
in case somebody has been waiting for it.
.Pp
.Sh SEE ALSO
.Xr vm_page_sleep_busy 9 ,
.Xr wakeup 9
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,67 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 13, 2001
.Dt VM_PAGE_WIRE 9
.Os
.Sh NAME
.Nm vm_page_wire ,
.Nm vm_page_unwire
.Nd "wire and unwire pages"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_wire "vm_page_t m"
.Ft void
.Fn vm_page_unwire "vm_page_t m" "int activate"
.Sh DESCRIPTION
The
.Fn vm_page_wire
function increments the wire count on a page, and removes if from
whatever queue it is on.
.Pp
The
.Fn vm_page_unwire
function releases one of the wirings on the page.
When
.Va write_count
reaches zero the page is placed back onto either the active queue
(if
.Fa activate
is non-zero) or onto the inactive queue (if
.Fa activate
is zero).
If the page is unmanaged
.Dv ( PG_UNMANAGED
is set) then the page is left on
.Dv PQ_NONE .
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,53 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 17, 2001
.Dt VM_PAGE_ZERO_FILL 9
.Os
.Sh NAME
.Nm vm_page_zero_fill
.Nd "zero fill a page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft boolean_t
.Fn vm_page_zero_fill "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_zero_fill
function zeros the given vm page by calling the machine dependant
.Fn pmap_zero_page
routine.
.Pp
.Fn vm_page_zero_fill
always returns
.Dv TRUE .
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,62 @@
.\"
.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice(s), this list of conditions and the following disclaimer as
.\" the first lines of this file unmodified other than the possible
.\" addition of one or more copyright notices.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice(s), this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
.\" DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd July 17, 2001
.Dt VM_SET_PAGE_SIZE 9
.Os
.Sh NAME
.Nm vm_set_page_size
.Nd "initialize the system page size"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_set_page_size
.Sh DESCRIPTION
The
.Fn vm_set_page_size
function initializes the system page size.
If
.Va cnt.v_page_size
(see
.Pa sys/vmmeter.h )
equals 0,
.Dv PAGE_SIZE
is used; otherwise, the value stored in
.Va cnt.v_page_size
is used.
If
.Va cnt.v_page_size
is not a power of two, the system will panic.
.Pp
.Fn vm_set_page_size
must be called prior to any page size dependent functions.
.Sh AUTHORS
This man page was written by
.An Chad David Aq davidc@acns.ab.ca .