Module Name: src Committed By: rmind Date: Mon Aug 3 19:08:48 UTC 2009
Modified Files: src/distrib/sets/lists/comp: mi src/share/man/man9: Makefile uvm.9 Added Files: src/share/man/man9: ubc.9 Log Message: Split descriptions of UBC functions from uvm(9) into separate ubc(9) man page. To generate a diff of this commit: cvs rdiff -u -r1.1288 -r1.1289 src/distrib/sets/lists/comp/mi cvs rdiff -u -r1.283 -r1.284 src/share/man/man9/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man9/ubc.9 cvs rdiff -u -r1.97 -r1.98 src/share/man/man9/uvm.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/comp/mi diff -u src/distrib/sets/lists/comp/mi:1.1288 src/distrib/sets/lists/comp/mi:1.1289 --- src/distrib/sets/lists/comp/mi:1.1288 Mon Aug 3 15:59:41 2009 +++ src/distrib/sets/lists/comp/mi Mon Aug 3 19:08:48 2009 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1288 2009/08/03 15:59:41 plunky Exp $ +# $NetBSD: mi,v 1.1289 2009/08/03 19:08:48 rmind Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -9161,6 +9161,7 @@ ./usr/share/man/cat9/uao_create.0 comp-sys-catman .cat ./usr/share/man/cat9/uao_detach.0 comp-sys-catman .cat ./usr/share/man/cat9/uao_reference.0 comp-sys-catman .cat +./usr/share/man/cat9/ubc.0 comp-sys-catman .cat ./usr/share/man/cat9/ubc_alloc.0 comp-sys-catman .cat ./usr/share/man/cat9/ubc_release.0 comp-sys-catman .cat ./usr/share/man/cat9/ubc_uiomove.0 comp-sys-catman .cat @@ -14525,6 +14526,7 @@ ./usr/share/man/html9/uao_create.html comp-sys-htmlman html ./usr/share/man/html9/uao_detach.html comp-sys-htmlman html ./usr/share/man/html9/uao_reference.html comp-sys-htmlman html +./usr/share/man/html9/ubc.html comp-sys-htmlman html ./usr/share/man/html9/ubc_alloc.html comp-sys-htmlman html ./usr/share/man/html9/ubc_release.html comp-sys-htmlman html ./usr/share/man/html9/ubc_uiomove.html comp-sys-htmlman html @@ -20104,6 +20106,7 @@ ./usr/share/man/man9/uao_create.9 comp-sys-man .man ./usr/share/man/man9/uao_detach.9 comp-sys-man .man ./usr/share/man/man9/uao_reference.9 comp-sys-man .man +./usr/share/man/man9/ubc.9 comp-sys-man .man ./usr/share/man/man9/ubc_alloc.9 comp-sys-man .man ./usr/share/man/man9/ubc_release.9 comp-sys-man .man ./usr/share/man/man9/ubc_uiomove.9 comp-sys-man .man Index: src/share/man/man9/Makefile diff -u src/share/man/man9/Makefile:1.283 src/share/man/man9/Makefile:1.284 --- src/share/man/man9/Makefile:1.283 Sat Jun 6 18:48:10 2009 +++ src/share/man/man9/Makefile Mon Aug 3 19:08:48 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.283 2009/06/06 18:48:10 hubertf Exp $ +# $NetBSD: Makefile,v 1.284 2009/08/03 19:08:48 rmind Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -54,7 +54,7 @@ vattr.9 veriexec.9 vcons.9 vfs.9 vfs_hooks.9 vfsops.9 vfssubr.9 \ video.9 vme.9 \ vnfileops.9 vnode.9 vnodeops.9 vnsubr.9 \ - usbdi.9 uvm.9 \ + ubc.9 usbdi.9 uvm.9 \ vmem.9 vmem_alloc.9 vmem_create.9 vmem_destroy.9 vmem_free.9 \ vmem_xalloc.9 vmem_xfree.9 \ wdc.9 \ @@ -648,6 +648,7 @@ tc.9 TC_PHYS_TO_UNCACHED.9 MLINKS+=todr.9 todr_gettime.9 todr.9 todr_settime.9 \ todr.9 clock_ymdhms_to_secs.9 todr.9 clock_secs_to_ymdhms.9 +MLINKS+=ubc.9 ubc_alloc.9 uvm.9 ubc_release.9 uvm.9 ubc_uiomove.9 MLINKS+=uvm.9 uvm_init.9 uvm.9 uvm_init_limits.9 uvm.9 uvm_setpagesize.9 \ uvm.9 uvm_swap_init.9 uvm.9 uvm_map.9 uvm.9 uvm_unmap.9 \ uvm.9 uvm_map_pageable.9 \ @@ -666,9 +667,6 @@ uvm.9 uvm_kernacc.9 uvm.9 uvm_vslock.9 \ uvm.9 uvm_vsunlock.9 uvm.9 uvm_meter.9 \ uvm.9 uvm_fork.9 uvm.9 uvm_grow.9 \ - uvm.9 ubc_alloc.9 \ - uvm.9 ubc_release.9 \ - uvm.9 ubc_uiomove.9 \ uvm.9 uvn_findpages.9 \ uvm.9 uvm_loan.9 uvm.9 uvm_unloan.9 MLINKS+=vme.9 vme_probe.9 \ Index: src/share/man/man9/uvm.9 diff -u src/share/man/man9/uvm.9:1.97 src/share/man/man9/uvm.9:1.98 --- src/share/man/man9/uvm.9:1.97 Thu Mar 12 13:13:16 2009 +++ src/share/man/man9/uvm.9 Mon Aug 3 19:08:48 2009 @@ -1,4 +1,4 @@ -.\" $NetBSD: uvm.9,v 1.97 2009/03/12 13:13:16 wiz Exp $ +.\" $NetBSD: uvm.9,v 1.98 2009/08/03 19:08:48 rmind Exp $ .\" .\" Copyright (c) 1998 Matthew R. Green .\" All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd March 12, 2009 +.Dd August 3, 2009 .Dt UVM 9 .Os .Sh NAME @@ -401,101 +401,6 @@ describing the type of access requested. .Fn uvm_fault returns a standard UVM return value. -.Sh MEMORY MAPPING FILES AND DEVICES -.Bl -ohang -.It Ft void -.Fn uvm_vnp_setsize "struct vnode *vp" "voff_t newsize" ; -.It Ft void * -.Fn ubc_alloc "struct uvm_object *uobj" "voff_t offset" "vsize_t *lenp" \ -"int advice" "int flags" ; -.It Ft void -.Fn ubc_release "void *va" "int flags" ; -.It Ft int -.Fn ubc_uiomove "struct uvm_object *uobj" "struct uio *uio" "vsize_t todo" \ -"int advice" "int flags" ; -.El -.Pp -.Fn uvm_vnp_setsize -sets the size of vnode -.Fa vp -to -.Fa newsize . -Caller must hold a reference to the vnode. -If the vnode shrinks, pages no longer used are discarded. -.Pp -.Fn ubc_alloc -creates a kernel mapping of -.Fa uobj -starting at offset -.Fa offset . -The desired length of the mapping is pointed to by -.Fa lenp , -but the actual mapping may be smaller than this. -.Fa lenp -is updated to contain the actual length mapped. -.Fa advice -is the access pattern hint, which must be one of -.Pp -.Bl -tag -offset indent -width "UVM_ADV_SEQUENTIAL" -compact -.It UVM_ADV_NORMAL -No hint -.It UVM_ADV_RANDOM -Random access hint -.It UVM_ADV_SEQUENTIAL -Sequential access hint (from lower offset to higher offset) -.El -.Pp -The possible -.Fa flags -are -.Pp -.Bl -tag -offset indent -width "UVM_ADV_SEQUENTIAL" -compact -.It UBC_READ -Mapping will be accessed for read. -.It UBC_WRITE -Mapping will be accessed for write. -.It UBC_FAULTBUSY -Fault in window's pages already during mapping operation. -Makes sense only for write. -.El -.Pp -Once the mapping is created, it must be accessed only by methods that can -handle faults, such as -.Fn uiomove -or -.Fn kcopy . -Page faults on the mapping will result in the object's pager -method being called to resolve the fault. -.Pp -.Fn ubc_release -frees the mapping at -.Fa va -for reuse. -The mapping may be cached to speed future accesses to the same region -of the object. -The flags can be any of -.Pp -.Bl -tag -offset indent -width "UVM_ADV_SEQUENTIAL" -compact -.It UBC_UNMAP -Do not cache mapping. -.El -.Pp -.Fn ubc_uiomove -allocates an UBC memory window, performs I/O on it and unmaps the window. -The -.Fa advice -parameter takes the same values as the respective parameter in -.Fn ubc_alloc -and the -.Fa flags -parameter takes the same arguments as -.Fn ubc_alloc -and -.Fn ubc_unmap . -Additionally, the flag -.Dv UBC_PARTIALOK -can be provided to indicate that it is acceptable to return if an error -occurs mid-transfer. .Sh VIRTUAL MEMORY I/O .Bl -ohang .It Ft int @@ -871,6 +776,8 @@ .It Ft void .Fn uvn_findpages "struct uvm_object *uobj" "voff_t offset" "int *npagesp" "struct vm_page **pps" "int flags" ; .It Ft void +.Fn uvm_vnp_setsize "struct vnode *vp" "voff_t newsize" ; +.It Ft void .Fn uvm_swap_stats "int cmd" "struct swapent *sep" "int sec" "register_t *retval" ; .El .Pp @@ -984,6 +891,14 @@ .Dv UFP_NORDONLY causes any pages which are marked PG_READONLY to be skipped. .Pp +.Fn uvm_vnp_setsize +sets the size of vnode +.Fa vp +to +.Fa newsize . +Caller must hold a reference to the vnode. +If the vnode shrinks, pages no longer used are discarded. +.Pp .Fn uvm_swap_stats implements the .Dv SWAP_STATS @@ -1124,7 +1039,8 @@ .Xr ddb 4 , .Xr options 4 , .Xr memoryallocators 9 , -.Xr pmap 9 +.Xr pmap 9 , +.Xr ubc 9 .Sh HISTORY UVM is a new VM system developed at Washington University in St. Louis (Missouri). @@ -1164,5 +1080,3 @@ .Aq c...@chuq.com implemented the aobj pager, thus allowing UVM to support System V shared memory and process swapping. -He also designed and implemented the UBC part of UVM, which uses UVM pages -to cache vnode data rather than the traditional buffer cache buffers. Added files: Index: src/share/man/man9/ubc.9 diff -u /dev/null src/share/man/man9/ubc.9:1.1 --- /dev/null Mon Aug 3 19:08:49 2009 +++ src/share/man/man9/ubc.9 Mon Aug 3 19:08:48 2009 @@ -0,0 +1,126 @@ +.\" $NetBSD: ubc.9,v 1.1 2009/08/03 19:08:48 rmind Exp $ +.\" +.\" Copyright (c) 1998 Matthew R. Green +.\" 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, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, 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 AUTHOR ``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 AUTHOR 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. +.\" +.Dd August 3, 2009 +.Dt UBC 9 +.Os +.Sh NAME +.Nm ubc +.Nd unified buffer cache +.Sh SYNOPSIS +.In uvm/uvm.h +.Bl -ohang +.It Ft void * +.Fn ubc_alloc "struct uvm_object *uobj" "voff_t offset" "vsize_t *lenp" \ +"int advice" "int flags" +.It Ft void +.Fn ubc_release "void *va" "int flags" +.It Ft int +.Fn ubc_uiomove "struct uvm_object *uobj" "struct uio *uio" "vsize_t todo" \ +"int advice" "int flags" +.El +.Sh DESCRIPTION +.Fn ubc_alloc +creates a kernel mapping of +.Fa uobj +starting at offset +.Fa offset . +The desired length of the mapping is pointed to by +.Fa lenp , +but the actual mapping may be smaller than this. +.Fa lenp +is updated to contain the actual length mapped. +.Fa advice +is the access pattern hint, which must be one of +.Pp +.Bl -tag -offset indent -width "UVM_ADV_SEQUENTIAL" -compact +.It UVM_ADV_NORMAL +No hint +.It UVM_ADV_RANDOM +Random access hint +.It UVM_ADV_SEQUENTIAL +Sequential access hint (from lower offset to higher offset) +.El +.Pp +The possible +.Fa flags +are +.Pp +.Bl -tag -offset indent -width "UVM_ADV_SEQUENTIAL" -compact +.It UBC_READ +Mapping will be accessed for read. +.It UBC_WRITE +Mapping will be accessed for write. +.It UBC_FAULTBUSY +Fault in window's pages already during mapping operation. +Makes sense only for write. +.El +.Pp +Once the mapping is created, it must be accessed only by methods that can +handle faults, such as +.Fn uiomove +or +.Fn kcopy . +Page faults on the mapping will result in the object's pager +method being called to resolve the fault. +.Pp +.Fn ubc_release +frees the mapping at +.Fa va +for reuse. +The mapping may be cached to speed future accesses to the same region +of the object. +The flags can be any of +.Pp +.Bl -tag -offset indent -width "UVM_ADV_SEQUENTIAL" -compact +.It UBC_UNMAP +Do not cache mapping. +.El +.Pp +.Fn ubc_uiomove +allocates an UBC memory window, performs I/O on it and unmaps the window. +The +.Fa advice +parameter takes the same values as the respective parameter in +.Fn ubc_alloc +and the +.Fa flags +parameter takes the same arguments as +.Fn ubc_alloc +and +.Fn ubc_unmap . +Additionally, the flag +.Dv UBC_PARTIALOK +can be provided to indicate that it is acceptable to return if an error +occurs mid-transfer. +.Sh HISTORY +UBC first appeared in +.Nx 1.6 . +.Sh AUTHORS +Chuck Silvers +.Aq c...@chuq.com +designed and implemented the UBC part of UVM, which uses UVM pages +to cache vnode data rather than the traditional buffer cache buffers.