More updates from Chad.

Submitted by: Chad David <davidc@acns.ab.ca>
Reviewed by: sheldonh
This commit is contained in:
Alfred Perlstein 2001-07-30 22:14:23 +00:00
parent 60b6effdc2
commit 0a6ca2a733
9 changed files with 314 additions and 9 deletions

View File

@ -59,9 +59,12 @@ MAN= BUF_LOCK.9 BUF_LOCKFREE.9 BUF_LOCKINIT.9 BUF_REFCNT.9 \
ucred.9 uidinfo.9 uio.9 \ ucred.9 uidinfo.9 uio.9 \
vcount.9 vfs_busy.9 vfs_mount.9 vfs_unbusy.9 vfs_unmountall.9 vget.9 \ vcount.9 vfs_busy.9 vfs_mount.9 vfs_unbusy.9 vfs_unmountall.9 vget.9 \
vinvalbuf.9 \ vinvalbuf.9 \
vm_page_alloc.9 vm_page_copy.9 vm_page_flag.9 vm_page_hold.9 \ vm_page_alloc.9 vm_page_cache.9 \
vm_page_copy.9 vm_page_deactivate.9 \
vm_page_flag.9 vm_page_free.9 vm_page_hold.9 \
vm_page_insert.9 vm_page_io.9 vm_page_lookup.9 \ vm_page_insert.9 vm_page_io.9 vm_page_lookup.9 \
vm_page_protect.9 vm_page_sleep_busy.9 vm_page_wakeup.9 \ vm_page_protect.9 vm_page_rename.9 \
vm_page_sleep_busy.9 vm_page_wakeup.9 \
vm_page_wire.9 vm_page_zero_fill.9 vm_set_page_size.9 \ vm_page_wire.9 vm_page_zero_fill.9 vm_set_page_size.9 \
vn_isdisk.9 vnode.9 vput.9 vref.9 vrele.9 \ vn_isdisk.9 vnode.9 vput.9 vref.9 vrele.9 \
vslock.9 \ vslock.9 \
@ -171,6 +174,9 @@ MLINKS+=uidinfo.9 uihashinit.9 uidinfo.9 uifind.9
MLINKS+=uidinfo.9 uihold.9 uidinfo.9 uifree.9 MLINKS+=uidinfo.9 uihold.9 uidinfo.9 uifree.9
MLINKS+=uio.9 uiomove.9 MLINKS+=uio.9 uiomove.9
MLINKS+=vm_page_flag.9 vm_page_flag_clear.9 vm_page_flag.9 vm_page_flag_set.9 MLINKS+=vm_page_flag.9 vm_page_flag_clear.9 vm_page_flag.9 vm_page_flag_set.9
MLINKS+=vm_page_free.9 vm_page_free_toq.9
MLINKS+=vm_page_free.9 vm_page_free_zero.9
MLINKS+=vm_page_free.9 vm_page_try_to_free.9
MLINKS+=vm_page_hold.9 vm_page_unhold.9 MLINKS+=vm_page_hold.9 vm_page_unhold.9
MLINKS+=vm_page_insert.9 vm_page_remove.9 MLINKS+=vm_page_insert.9 vm_page_remove.9
MLINKS+=vm_page_io.9 vm_page_io_start.9 vm_page_io.9 vm_page_io_finised.9 MLINKS+=vm_page_io.9 vm_page_io_start.9 vm_page_io.9 vm_page_io_finised.9

View File

@ -48,6 +48,14 @@
.Fn relpbuf "struct buf *bp" "int *pfreecnt" .Fn relpbuf "struct buf *bp" "int *pfreecnt"
.Sh DESCRIPTION .Sh DESCRIPTION
These functions are used to allocate and release physical buffers. These functions are used to allocate and release physical buffers.
.Pp
The physical buffers are allocated at system startup and are
maintained in a separate pool from the main system buffers.
They are intended for use by subsystems that cannot or should not be
reliant on the main pool of buffers (for example the swap pager).
The system allocates between 16 and 256 physical buffers depending
on the amount of memory in the system.
.Pp
Each subsystem that allocates buffers via these calls is expected Each subsystem that allocates buffers via these calls is expected
to manage its own percentage free counter. to manage its own percentage free counter.
If the value is initialized to \-1 the number of buffers available If the value is initialized to \-1 the number of buffers available
@ -120,5 +128,5 @@ In the case of
.Dv NULL .Dv NULL
can also be returned indicating that there are no buffers available. can also be returned indicating that there are no buffers available.
.Sh AUTHORS .Sh AUTHORS
This man page was written by This manual page was written by
.An Chad David Aq davidc@acns.ab.ca . .An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,51 @@
.\"
.\" 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 24, 2001
.Dt VM_PAGE_CACHE 9
.Os
.Sh NAME
.Nm vm_page_cache
.Nd "move a page onto the cache queue"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_cache "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_cache
function moves a page onto the cache queue,
and removes any protection that may be set on the page.
If the page is busy, wired or unmanaged then the move
to the cache queue will fail.
If the page is dirty the system will panic.
.Sh AUTHORS
This manual page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -49,6 +49,9 @@ into
The entire contents of The entire contents of
.Fa dst_m .Fa dst_m
are marked as valid. are marked as valid.
.Pp
The actual copy is performed by
.Fn pmap_copy_page .
.Sh AUTHORS .Sh AUTHORS
This man page was written by This manual page was written by
.An Chad David Aq davidc@acns.ab.ca . .An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,51 @@
.\"
.\" 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 24, 2001
.Dt VM_PAGE_DEACTIVATE 9
.Os
.Sh NAME
.Nm vm_page_deactivate
.Nd "deactivate a page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_deactivate "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_deactivate
function moves the given page to the inactive queue as long as it is
unmanaged and is not wired.
.Sh SEE ALSO
.Xr vm_page_wire 9
.Xr vm_page_unmanage 9
.Sh AUTHORS
This manual 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 24, 2001
.Dt VM_PAGE_FREE 9
.Os
.Sh NAME
.Nm vm_page_free
.Nm vm_page_free_toq
.Nm vm_page_free_zero
.Nm vm_page_try_to_free
.Nd "free a page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fn vm_page_free "vm_page_t m"
.Ft void
.Fn vm_page_free_toq "vm_page_t m"
.Ft void
.Fn vm_page_free_zero "vm_page_t m"
.Ft int
.Fn vm_page_try_to_free "vm_page_t m"
.Sh DESCRIPTION
The
.Fn vm_page_free_toq
function moves a page into the free queue, and disassociates it from
its object.
If the page is held, wired, already free, or its busy count is not
zero the system will panic.
If the
.Dv PG_ZERO
flag is set on the page is it placed at the end of the free queue;
otherwise, it is placed at the front.
.Pp
If the page's object is of type
.Dv OBJT_VNODE
and it is the last page associated with the object the underlying
vnode may be freed.
.Pp
The
.Fn vm_page_free
and
.Fn vm_page_free_zero
functions both call
.Fn vm_page_free_toq
to actually free page, but
.Fn vm_page_free_zero
sets the
.Dv PG_ZERO
flag and
.Fn vm_page_free
clears the
.Dv PG_ZERO
flag prior to the call to
.Fn vm_page_free_toq .
.Pp
The
.Fn vm_page_try_to_free
function verifies that the page is not held, wired, busy or dirty, and
if so marks the page as busy, drops any protection that may be set on
the page, and frees it.
.Sh RETURN VALUES
.Fn vm_page_try_to_free
returns 1 if it is able to free the page; otherwise, 0 is returned.
.Sh SEE ALSO
.Xr vm_page_busy 9 ,
.Xr vm_page_hold 9 ,
.Xr vm_page_wire 9
.Sh AUTHORS
This manual page was written by
.An Chad David Aq davidc@acns.ab.ca .

View File

@ -46,9 +46,20 @@ The
.Fn vm_page_hold .Fn vm_page_hold
function increases the hold count on a page. function increases the hold count on a page.
This prevents the page daemon from freeing the page. This prevents the page daemon from freeing the page.
.Pp
.Fn vm_page_hold .Fn vm_page_hold
should only be used for very temporary wiring of a page. should only be used for very temporary wiring of a page,
If the page needs to be held for a longer period as that page will not be considered for paging or
reallocation for as long as its hold count is greater
than zero.
Also note that while wired pages are removed from whatever
queue they are on,
.Fn vm_page_hold
does not affect the location of the page.
If it is on a queue prior to the call, it will still
be there afterward.
.Pp
If the page needs to be held for a long period of time,
.Fn vm_page_write .Fn vm_page_write
should be used. should be used.
.Pp .Pp
@ -60,5 +71,5 @@ page daemon.
.Xr vm_page_wire 9 .Xr vm_page_wire 9
.Xr wm_page_unwire 9 .Xr wm_page_unwire 9
.Sh AUTHORS .Sh AUTHORS
This man page was written by This manual page was written by
.An Chad David Aq davidc@acns.ab.ca . .An Chad David Aq davidc@acns.ab.ca .

View File

@ -46,7 +46,7 @@ The
.Fn vm_page_insert .Fn vm_page_insert
function adds a page to the given object at the given index. 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 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. object's list of pages, but the hardware page tables are not updated.
In the case of a user page, it will be faulted in when it is In the case of a user page, it will be faulted in when it is
accessed. accessed.
If the page is a kernel page the caller is expected to If the page is a kernel page the caller is expected to
@ -86,6 +86,11 @@ are:
.It m .It m
The page to remove. The page to remove.
.El .El
.Sh IMPLEMENTATION NOTES
The index of a page in a VM object is the byte index into the
same object truncated to a page boundary.
For example, if the page size is 4096 bytes, and the address
in the object is 81944, the page index is 20.
.Sh AUTHORS .Sh AUTHORS
This man page was written by This manual page was written by
.An Chad David Aq davidc@acns.ab.ca . .An Chad David Aq davidc@acns.ab.ca .

View File

@ -0,0 +1,72 @@
.\"
.\" 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_RENAME 9
.Os
.Sh NAME
.Nm vm_page_rename
.Nd "moves a page"
.Sh SYNOPSIS
.In sys/param.h
.In vm/vm.h
.In vm/vm_page.h
.Ft void
.Fo vm_page_rename
.Fa "vm_page_t m"
.Fa "vm_object_t new_object"
.Fa "vm_pindex_t new_pindex"
.Fc
.Sh DESCRIPTION
The
.Fn vm_page_rename
function removes a page from one object, and adds it to another
at the given page index.
The page is added to the given object, and is removed from the
object that is currently associated with.
If the page is currently on the cache queue it will be deactivated
unless it is wired or unmanaged, in which case the deactivation will
fail.
The entire page is marked as dirty after the move.
.Pp
The arguments to
.Fn vm_page_rename
are:
.Bl -tag -width ".Fa new_object"
.It m
The page to move.
.It new_object
The object the page should be inserted into.
.It new_pindex
The page index into
.Fa new_object
at which the new page should be inserted.
.El
.Sh AUTHORS
This manual page was written by
.An Chad David Aq davidc@acns.ab.ca .