Commit Graph

700 Commits

Author SHA1 Message Date
chs a548bfb584 add an assert. 2001-09-21 07:57:35 +00:00
chs 20a658f0ab work around swap-space/extent performance problem which causes
long pauses when processes with lots of swapped-out pages exit.
2001-09-19 03:41:46 +00:00
chs 64c6d1d2dc a whole bunch of changes to improve performance and robustness under load:
- remove special treatment of pager_map mappings in pmaps.  this is
   required now, since I've removed the globals that expose the address range.
   pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
   no longer any need to special-case it.
 - eliminate struct uvm_vnode by moving its fields into struct vnode.
 - rewrite the pageout path.  the pager is now responsible for handling the
   high-level requests instead of only getting control after a bunch of work
   has already been done on its behalf.  this will allow us to UBCify LFS,
   which needs tighter control over its pages than other filesystems do.
   writing a page to disk no longer requires making it read-only, which
   allows us to write wired pages without causing all kinds of havoc.
 - use a new PG_PAGEOUT flag to indicate that a page should be freed
   on behalf of the pagedaemon when it's unlocked.  this flag is very similar
   to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
   pageout fails due to eg. an indirect-block buffer being locked.
   this allows us to remove the "version" field from struct vm_page,
   and together with shrinking "loan_count" from 32 bits to 16,
   struct vm_page is now 4 bytes smaller.
 - no longer use PG_RELEASED for swap-backed pages.  if the page is busy
   because it's being paged out, we can't release the swap slot to be
   reallocated until that write is complete, but unlike with vnodes we
   don't keep a count of in-progress writes so there's no good way to
   know when the write is done.  instead, when we need to free a busy
   swap-backed page, just sleep until we can get it busy ourselves.
 - implement a fast-path for extending writes which allows us to avoid
   zeroing new pages.  this substantially reduces cpu usage.
 - encapsulate the data used by the genfs code in a struct genfs_node,
   which must be the first element of the filesystem-specific vnode data
   for filesystems which use genfs_{get,put}pages().
 - eliminate many of the UVM pagerops, since they aren't needed anymore
   now that the pager "put" operation is a higher-level operation.
 - enhance the genfs code to allow NFS to use the genfs_{get,put}pages
   instead of a modified copy.
 - clean up struct vnode by removing all the fields that used to be used by
   the vfs_cluster.c code (which we don't use anymore with UBC).
 - remove kmem_object and mb_object since they were useless.
   instead of allocating pages to these objects, we now just allocate
   pages with no object.  such pages are mapped in the kernel until they
   are freed, so we can use the mapping to find the page to free it.
   this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
2001-09-15 20:36:31 +00:00
chris 0e7661f023 Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
2001-09-10 21:19:08 +00:00
chs 2133049a7c create a new pool for map entries, allocated from kmem_map instead of
kernel_map.  use this instead of the static map entries when allocating
map entries for kernel_map.  this greatly reduces the number of static
map entries used and should eliminate the problems with running out.
2001-09-09 19:38:22 +00:00
lukem 53156d96d0 let user know current value of MAX_KMAPENT in panic 2001-09-07 00:50:54 +00:00
chuck 2dec1a929d handle a locking problem where the second (or later) call in the loanentry
loop returns 0.   loanentry was returning >0, but was unlocking the maps
(because of the zero).   reworked to avoid this.  problem reported by
chuck silvers.   also clarify a comment that jdolecek asked about.
2001-08-27 02:34:29 +00:00
chs a65671c2a9 don't mess with vnode holds or buffer lists for swap i/os.
fixes problems with leaked vnode holds.
2001-08-26 00:43:53 +00:00
chs ed1e153702 use the correct symbol for multi-include protection. 2001-08-25 20:37:46 +00:00
wiz c52d355d71 "wierd" is weird. 2001-08-20 12:20:01 +00:00
chs 2233d77cac when fetching an object page to loan out, do so synchronously. 2001-08-18 05:51:44 +00:00
chs 2c441082d4 allow mappings of VBLK vnodes. 2001-08-17 05:53:02 +00:00
chs 37f6c5155d call VOP_MMAP() before allowing mappings of vnodes to allow
filesystems which do not support memory mapped access to cause
mmap() of their vnodes to fail.
2001-08-17 05:52:46 +00:00
chs e9fbc91f95 user maps are always pageable. 2001-08-16 01:37:50 +00:00
matt cce919e025 Don't include <machine/pmap.h> and <machine/vmparam.h> if _KERNEL isn't
defined.  Include them explicitly in the few kvm_arch.c that need them.
2001-08-05 03:33:15 +00:00
thorpej ae69446f0f Back out previous -- christos needs to update his lint(1). 2001-07-25 23:05:04 +00:00
christos 8228035453 fix non-portable bitmap warning. 2001-07-25 22:41:10 +00:00
wiz a9356936b4 seperate -> separate 2001-07-22 13:33:58 +00:00
thorpej cbf41a143a bzero -> memset 2001-07-18 16:43:09 +00:00
matt f300898396 Add support for kern.maxphys, vm.maxslp, vm.uspace (the later two for ps). 2001-07-14 06:36:01 +00:00
thorpej c3cd2c3cfc Rather than using u_shorts, use u_ints and bitfields in the vm_page. This
provides us more flexibility with pageq-locked fields, and clarifies the
locking semantics for platforms which cannot address shorts.

From Ross Harvey.
2001-06-28 00:26:38 +00:00
thorpej 8217ab697c Since a page can be on only one of ACTIVE or INACTIVE queues at
any given time, turn two consecutive if statements into an if-else-if
construct.
2001-06-27 23:57:16 +00:00
thorpej 27f66d3bf7 Macro'ize the code that checks the free and inactive thresholds and
wakes the pagedaemon.
2001-06-27 21:18:34 +00:00
thorpej 9917ae5683 G/c a comment that no longer applies. 2001-06-27 18:52:10 +00:00
thorpej a279b0973b Reduce some complexity in the fault path -- Rather than maintaining
an spl-protected "interrupt safe map" list, simply require that callers
of uvm_fault() never call us in interrupt context (MD code must make
the assertion), and check for interrupt-safe maps in uvmfault_lookup()
before we lock the map.
2001-06-26 17:55:14 +00:00
thorpej 78ae4127bb Note that uvm_fault() must NEVER EVER EVER be called in interrupt
context.
2001-06-26 17:27:31 +00:00
chs 2d06d7932a don't for memory in uao_set_swlot() since we're holding spinlocks,
instead return -1.  adjust callers to handle this new error return.
fixes PR 13194.
2001-06-23 20:52:03 +00:00
chs 88cc5dd4b8 clean up the transient error case in uvm_pager_put(). 2001-06-23 20:47:44 +00:00
chs 58079906be don't use the list pointers after we take an object off its list. 2001-06-22 06:20:24 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
chs 7e00a527ea work around an overflow problem in uvm_fault_wire().
from Eduardo Horvath and Simon Burge.
2001-06-14 05:12:56 +00:00
simonb 85ded6700b Add a sanity check for ubc_winshift. 2001-06-13 06:06:19 +00:00
mrg b0b1999665 uvm_coredump32() moved into compat/netbsd32. 2001-06-06 21:28:51 +00:00
chs 821ec03ed9 replace vm_map{,_entry}_t with struct vm_map{,_entry} *. 2001-06-02 18:09:08 +00:00
lukem d84d2c6c85 add missing #include "opt_kgdb.h" 2001-05-30 15:24:23 +00:00
mrg 67afbd6270 use _KERNEL_OPT 2001-05-30 11:57:16 +00:00
chs 11a9651c8f replace vm_page_t with struct vm_page *. 2001-05-26 21:27:10 +00:00
chs 118ddca24a replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}. 2001-05-26 16:32:40 +00:00
chs 3845302904 remove trailing whitespace. 2001-05-25 04:06:11 +00:00
ross 892627dd05 Merge the swap-backed and object-backed inactive lists. 2001-05-22 00:44:44 +00:00
ross d8840def52 Expand on the locking notes comment with a XXX warning about u_short fields. 2001-05-16 00:16:01 +00:00
ross 91646d1aa5 Eliminate lhs cast (incorrectly accepted by gcc) 2001-05-15 09:04:00 +00:00
thorpej e2a791df22 Use pool_init() rather than pool_create(). 2001-05-09 23:20:59 +00:00
fvdl defa9bf05f Avoid potential cases of sleeping while holding a spinlock. Pay attention
to SWF_FAKE when finding a swap device. GC swapdrum_add; it was only
a few lines long and called once, so just inline the code there.
2001-05-09 19:21:02 +00:00
thorpej 0b8c6fcc77 Fix a silly mistake I made when reworking the uvm inactive list
some time ago.  The mistake was to check that the page was not
referenced since the last active scan before moving it to inactive.
Now we just clear reference and move it to inacive (which is where
the second clock hand sweep occurs).
2001-05-07 22:01:28 +00:00
thorpej 04f36fcb9e Remove a comment which is no longer true. From Artur Grabowski. 2001-05-06 20:12:09 +00:00
ross 6b9d94cd8c Fix overflow errors in brk(2). 2001-05-06 04:32:08 +00:00
thorpej 31fafb678f Support dynamic sizing of the page color bins. We also support
dynamically re-coloring pages; as machine-dependent code discovers
the size of the system's caches, it may call uvm_page_recolor() with
the new number of colors to use.  If the new mumber of colors is
smaller (or equal to) the current number of colors, then uvm_page_recolor()
is a no-op.

The system defaults to one bucket if machine-dependent code does not
initialize uvmexp.ncolors before uvm_page_init() is called.

Note that the number of color bins should be initialized to something
reasonable as early as possible -- for many early memory allocations,
we live with the consequences of the page choice for the lifetime of
the boot.
2001-05-02 01:22:19 +00:00
thorpej 01e2971ba2 Add the number of page colors to uvmexp. 2001-05-01 19:36:56 +00:00
enami 1132ef7f20 Use simple do {} while () loop instead of for {} loop + extra test/variable. 2001-05-01 14:02:56 +00:00
enami d211385f8a Fix second level indentation in recent commit. 2001-05-01 13:42:34 +00:00
thorpej 220bcf69ac Garbage-collect a comment that has not been applicable since Mach. 2001-05-01 03:01:18 +00:00
thorpej cf67ac7122 Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
2001-05-01 02:19:13 +00:00
thorpej 2b27ac7a99 Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure.  Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM.  These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

This deprecates struct pmap_physseg.  As a transitional measure,
allow a port to #define PMAP_PHYSSEG so that it can continue to
use it until its pmap is converted to use VM_MDPAGE_MEMBERS.

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now).  Changes to other pmap
modules will follow.
2001-04-29 22:44:31 +00:00
thorpej cda7baa0d5 Implement page coloring, using a round-robin bucket selection
algorithm (Solaris calls this "Bin Hopping").

This implementation currently relies on MD code to define a
constant defining the number of buckets.  This will change
reasonably soon (MD code will be able to dynamically size
the bucket array).
2001-04-29 04:23:20 +00:00
marcus d317b08ca6 STDC cleanup: extra token not allowed after #endif. 2001-04-27 00:14:47 +00:00
thorpej 93b0af8f60 pmap_resident_count() always exists. Besides, returning the
value of vm_rssize is pointless -- it is never initialized to
anything other than 0.
2001-04-25 18:09:52 +00:00
thorpej 773ed79e5b Add a comment describing a problem. 2001-04-25 14:59:44 +00:00
thorpej 1c3a62e066 Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative.  It may be possible to
optimize these a little more.
2001-04-24 04:30:50 +00:00
thorpej 0e325bb097 Some spring cleaning. 2001-04-24 00:19:00 +00:00
thorpej 55044638aa Remove pmap_kenter_pgs(). It was never really adopted by
anything, and the interface itself wasn't as flexible as
callers would have probably liked.
2001-04-22 23:42:11 +00:00
thorpej 69abdbf60c Undo a misguided previous change to the pmap_update() API. 2001-04-22 23:19:26 +00:00
thorpej cfb5c7ed9f Make pmap_virtual_space() a required pmap function, even on platforms
which have pmap_steal_memory().  This is to reduce the API differences
between pmaps that implement pmap_steal_memory() and pmaps which do
not.

Note that pmap_steal_memory() needs to adjust *vstartp and/or
*vendp only if it used addresses within the range provided to UVM
via the pmap_virtual_space() call.  I.e. it is not necessary to do
so in any current pmap_steal_memory() implementation.
2001-04-22 17:22:57 +00:00
thorpej 4738622712 Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
2001-04-22 00:33:59 +00:00
thorpej 0115ec662c The pmap_update() call at the end of uvm_swapout_threads() is
completely useless.  Nuke it.
2001-04-21 17:38:24 +00:00
thorpej 9e0af4a217 Add a __predict_true() to an extremely common case. 2001-04-12 21:11:47 +00:00
thorpej eed75ba69e In uvm_km_kmemalloc(), use the correct size for the uvm_unmap()
call if the allocation fails.

Problem pointed out by Alfred Perlstein <bright@wintelcom.net>,
who found a similar bug in FreeBSD.
2001-04-12 21:08:25 +00:00
chuck 7074958a24 fix locking problem noted by Jaromir Dolecek. also, add more comments
on locking rules to make code easier to understand.   locking in
uvm_loananon still needs some work on fringe cases where anon's page
is actually on loan from a uobj.
2001-04-10 00:53:21 +00:00
jdolecek 5bd42953f7 Upon Chuck Cranor request, revert rev. 1.26. There is indeed a bug in way
locking is done, but this fix is not the right way to fix it.
2001-04-09 06:21:03 +00:00
jdolecek 17c0a84170 Remove superflous uvmfault_unlockmaps() in uvm_loan(), only call it
if uvm_loanentry() returned 0; otherwise, the unlocking would already
have been done by uvmfault_unlockall() call in  uvm_loanentry().
Okay'ed by Chuck Silvers
2001-04-08 16:51:51 +00:00
chs 088989a557 undo the part of a previous commit which turned a check for faulting
on an "intrsafe" map into a KASSERT.  this situation can be caused by
an application accessing /dev/kmem.
2001-04-01 16:45:53 +00:00
chs 11fe9ca446 use ubc_winshift instead of ubc_winsize in pmaps to set up kernel
virtual space.  the latter isn't initialized yet when the value is needed.
fixes PR 12440.
2001-03-21 03:16:05 +00:00
simonb d618ec62ad In sys_obreak(), the return value of atop() was being used to change
the process dsize for both positive and negative changes.  Since atop()
casts its result to a paddr_t (which is unsigned), negative changes in
process data size resulted in unrealistic dsizes being set.  Use
"dsize -= atop(-diff)" for a negative diffs.  Fixes the "Impossible
process sizes" mentioned on current-users.

Unsigned cast catch and much debugging help from Martin Laubach.
2001-03-19 02:25:33 +00:00
chs c40daf0aed change uvm_winsize to uvm_winshift so that we can avoid division
by a non-constant value.
2001-03-19 00:29:03 +00:00
chs edb041f0d1 return the real error from pgo_fault(). 2001-03-17 04:01:24 +00:00
chs 19accb3d77 return the real error from VOP_GETPAGES(). 2001-03-17 04:01:02 +00:00
chs ac3bc537bd eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS			0
KERN_INVALID_ADDRESS		EFAULT
KERN_PROTECTION_FAILURE		EACCES
KERN_NO_SPACE			ENOMEM
KERN_INVALID_ARGUMENT		EINVAL
KERN_FAILURE			various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE		ENOMEM
KERN_NOT_RECEIVER		<unused>
KERN_NO_ACCESS			<unused>
KERN_PAGES_LOCKED		<unused>
2001-03-15 06:10:32 +00:00
chs dd82ad8e2c eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:

VM_PAGER_OK		        0
VM_PAGER_BAD		        <unused>
VM_PAGER_FAIL		        <unused>
VM_PAGER_PEND		        0 (see below)
VM_PAGER_ERROR		        EIO
VM_PAGER_AGAIN		        EAGAIN
VM_PAGER_UNLOCK		        EBUSY
VM_PAGER_REFAULT	        ERESTART

for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
2001-03-10 22:46:45 +00:00
chs 83d071a318 add UBC memory-usage balancing. we track the number of pages in use for
each of the basic types (anonymous data, executable image, cached files)
and prevent the pagedaemon from reusing a given page if that would reduce
the count of that type of page below a sysctl-setable minimum threshold.
the thresholds are controlled via three new sysctl tunables:
vm.anonmin, vm.vnodemin, and vm.vtextmin.  these tunables are the
percentages of pageable memory reserved for each usage, and we do not allow
the sum of the minimums to be more than 95% so that there's always some
memory that can be reused.
2001-03-09 01:02:10 +00:00
enami 79dbb12278 When shrinking file size, don't dispose of a page still in use. 2001-02-22 01:02:09 +00:00
chs 19b7b64642 clean up DIAGNOSTIC checks, use KASSERT(). 2001-02-18 21:19:08 +00:00
chs 7b76ca8254 in uvn_flush(), add a fast path for the case where the vnode has no pages.
update the comment above this function while I'm here.
2001-02-18 19:40:25 +00:00
chs 4808c1dfb5 in uvm_aio_aiodone(), don't mark the page(s) clean if the pageout
failed because we failed to acquire some resource needed to initiate
the pageout (such as failing to lock an indirect buffer) rather than
a hard i/o error.  in this case we just want to reactivate the page(s)
so that we'll try to write them again later.

while I'm here, clean up some DIAGNOSTIC code.
2001-02-18 19:26:50 +00:00
pk dca7b5b472 SWAP_DUMPDEV,SWAP_OFF cases: make sure to release the vnode being operated on. 2001-02-12 11:50:50 +00:00
eeh 4589ac3292 When recycling a vm_map, resize it to the new process address space limits. 2001-02-11 01:34:23 +00:00
thorpej b016744976 Don't uvm_deallocate() the address space in exit1(). The address
space is already torn down in uvmspace_free() when the vmspace
refrence count reaches 0.  Move the shmexit() call into uvmspace_free().

Note that there is a beneficial side-effect of deferring the unmap
to uvmspace_free() -- on systems where TLB invalidations are
particularly expensive, the unmapping of the address space won't
have to cause TLB invalidations; uvmspace_free() is going to be
run in a context other than the exiting process's, so the "pmap is
active" test will evaluate to FALSE in the pmap module.
2001-02-10 05:05:27 +00:00
chs 4be5f47040 remove a debug printf() that has outlived its usefulness. 2001-02-08 06:43:05 +00:00
eeh ec22628573 Move maxdmap and maxsmap where they belong and make them big enough. 2001-02-06 19:54:43 +00:00
eeh 4380259bc7 Specify a process' address space limits for uvmspace_exec(). 2001-02-06 17:01:51 +00:00
chs 43eb344e3f in uvn_flush(), interpret a "stop" value of 0 as meaning all pages at
offsets equal to or higher than "start".  use this in uvm_vnp_setsize()
instead of the vnode's size since there can be pages past EOF.
2001-02-06 10:53:23 +00:00
chs 4d5451090e in uvm_map_clean(), fix the case where the start offset is within the last
entry in the map.  the old code would walk around the end of the linked list,
through the header entry, and keep going from the first map entry until it
found a gap in the map, at which point it would return an error.  if the map
had no gaps then it would loop forever.  reported by k-abe@cs.utah.edu.
while I'm here, clean up this function a bit.

also, use MIN() instead of min(), since the latter takes arguments of
type "int" but we're passing it values of type "vaddr_t", which can be
a larger size.
2001-02-05 11:29:54 +00:00
mrg 6e26ebea51 allow ubchist to be printed from the uvmhist merging uvm_hist() 2001-02-04 10:55:58 +00:00
mrg 0c151f32c8 add a KASSERT(pp) in the uvm_pagermapin() loop. 2001-02-04 10:55:12 +00:00
enami dda0d50982 Explicitly panic if failed to allocate some memory during initialization. 2001-02-02 01:55:52 +00:00
thorpej 1779f8f71b Page scanner improvements, behavior is actually a bit more like
Mach VM's now.  Specific changes:
- Pages now need not have all of their mappings removed before being
  put on the inactive list.  They only need to have the "referenced"
  attribute cleared.  This makes putting pages onto the inactive list
  much more efficient.  In order to eliminate redundant clearings of
  "refrenced", callers of uvm_pagedeactivate() must now do this
  themselves.
- When checking the "modified" attribute for a page (for clearing
  PG_CLEAN), make sure to only do it if PG_CLEAN is currently set on
  the page (saves a potentially expensive pmap operation).
- When scanning the inactive list, if a page is referenced, reactivate
  it (this part was actually added in uvm_pdaemon.c,v 1.27).  This
  now works properly now that pages on the inactive list are allowed to
  have mappings.
- When scanning the inactive list and considering a page for freeing,
  remove all mappings, and then check the "modified" attribute if the
  page is marked PG_CLEAN.
- When scanning the active list, if the page was referenced since its
  last sweep by the scanner, don't deactivate it.  (This part was
  actually added in uvm_pdaemon.c,v 1.28.)

These changes greatly improve interactive performance during
moderate to high memory and I/O load.
2001-01-28 23:30:42 +00:00
thorpej 1cdff48674 Put the extern decl of uvm_vnodeops in uvm_object.h 2001-01-28 22:23:04 +00:00
thorpej 5849b86934 Use UVM_OBJ_IS_VNODE(). 2001-01-28 22:14:52 +00:00
thorpej d1c3f6bab3 Define a UVM_OBJ_IS_VNODE() macro to test if an object is a vnode. 2001-01-28 22:14:28 +00:00
thorpej 37247109d1 When considering a page for deactivation, check to see if the
page has been referenced since the last time it was considered.
If it was, don't deactivate the page.
2001-01-25 00:24:48 +00:00
mycroft 91a4c18e32 Put back the pmap_is_referenced() check from the original UVM code in the
inactive list scans.  Without this, the referenced bit was essentially ignored.
2001-01-25 00:10:03 +00:00
thorpej ad7259d7c6 Change uvm_analloc() to return a locked anon, update all callers,
and fix an anon locking protocol error in uvm_loanzero().
2001-01-23 02:27:39 +00:00
thorpej 13759f5310 Sprinkle some assertions:
amap_free(): Assert that the amap is locked.
amap_share_protect(): Assert that the amap is locked.
amap_wipeout(): Assert that the amap is locked.
uvm_anfree(): Assert that the anon has a reference count of 0 and is
              not locked.
uvm_anon_lockloanpg(): Assert that the anon is locked.
anon_pagein(): Assert that the anon is locked.
uvmfault_anonget(): Assert that the anon is locked.
uvm_pagealloc_strat(): Assert that the uobj or the anon is locked

And fix the problems these have uncovered:
amap_cow_now(): Lock the new anon after allocating it, and unref and
                unlock it (rather than lock!) before freeing it in case
                of an error condition.  This should fix a problem reported
		by Dan Carosone using cdrecord on an i386 MP kernel.
uvm_fault(): Case1B -- Lock the new anon afer allocating it, and unlock
             it later when we unlock the old anon.
	     Case2 -- Lock the new anon after allocating it, and unlock
	     it later by passing it to uvmfault_unlockall() (we set anon
	     to NULL if we're not doing a promote fault).
2001-01-23 01:56:16 +00:00
thorpej f4395a4eae splimp() -> splvm() 2001-01-14 02:10:01 +00:00
pk f134ba4486 atop(): cast argument to `paddr_t' (instead of `u_long') to avoid
truncating the address.
2001-01-09 13:55:20 +00:00
chs f0ff6fc897 in uvn_flush(), when PGO_SYNCIO is specified then we should wait for
pending i/os to complete before returning even if PGO_CLEANIT is not
specified.  this fixes two races:

 (1) NFS write rpcs vs. setattr operations which truncate the file.
     if the truncate doesn't wait for pending writes to complete then
     a later write rpc completion can undo the effect of the truncate.
     this problem has been reported by several people.

 (2) write i/os in disk-based filesystem vs. the disk block being
     freed by a truncation, allocated to a new file, and written
     again with different data.  if the disk driver reorders the requests
     and does the second i/o first, the old data will clobber the new,
     corrupting the new file.  I haven't heard of anyone experiencing
     this problem yet, but it's fixed now anyway.
2001-01-08 06:21:13 +00:00
thorpej 4d4b2b5626 Nevermind that it's silly to include PROT_EXEC even if a vnode
doesn't have the exec bit set, we need to have PROT_EXEC set
in order for some expected mmap/mprotect behavior to work, so
do the last bit slightly differently: if udv_attach() fails, and
the protection (NOT maxprot) doens't include PROT_EXEC, then clear
PROT_EXEC from maxprot and try udv_attach() again.

Sigh, mmap really needs to be rototilled.
2001-01-08 01:35:03 +00:00
thorpej 781516b080 Only include PROT_EXEC in maxprot if the user specified PROT_EXEC
in the mmap() call.  maxprot is used to create device mappings,
and always including PROT_EXEC causes the mapping to fail on the Alpha
when mapping a non-RAM offset of /dev/mem (which may be sparse, so
instruction fetch from there is disallowed).
2001-01-07 06:16:46 +00:00
enami f306f72978 Use cast where appropriate to avoid integer overflow. 2001-01-04 06:07:18 +00:00
chs 1e651a1688 remove some more leftovers from Mach. 2000-12-28 08:24:55 +00:00
chs 89b005fc27 when we fail to allocate anons to represent new swap space,
just return an error rather than panicing.
2000-12-27 09:17:04 +00:00
chs 910b4f2e20 fix some types so that files larger than 4GB work. 2000-12-27 09:01:45 +00:00
chs de569051ad VOP_GETPAGES() returns an E* error code, not a VM_PAGER_* error code. 2000-12-27 04:44:42 +00:00
enami 6ff137de16 Place a name of extent in a struct swapdev instead of dynamically
allocating it.
2000-12-23 12:13:05 +00:00
enami 4e59adc1bb s/UBC_WINSIZE/ubc_winsize/g except the variable initialization. 2000-12-21 03:37:59 +00:00
chs fc03073896 expose the tunables ubc_nwins and ubc_winsize in uvm_param.h.
add the space used by UBC mappings to the initial PTE calculations
for pmaps that do that (mips and alpha).
2000-12-21 00:52:01 +00:00
chs 34a059b354 in uvn_flush(), don't deactivate busy pages. 2000-12-16 06:17:09 +00:00
chs cf25b3fa04 continue processing the inactive queue past the free target when
we're enforcing the limit on the number of vnode pages.
2000-12-13 17:03:32 +00:00
enami 4625dcde2e Use single const char array instead of over 200 string constant. 2000-12-13 08:06:11 +00:00
chs 837f5c9bd6 we don't need VM_PROT_EXECUTE for UBC mappings. 2000-12-10 19:28:09 +00:00
chs cae7ac2e3a in uvm_pagermapin(), for now, don't pass the flag to pmap_enter()
which presets the page modified bit if the page is already initialized.
we don't actually want to modify such pages.
2000-12-09 23:26:27 +00:00
chs a8609aaac8 in uvn_findpage(), only increment the counter of vnode pages
if we succeed in allocating a page.

from Lars Heidieker <lars@heidieker.de> in PR 11636.
2000-12-06 03:37:30 +00:00
chs eeabe3f90d make sure that pages are on an paging queue before unlocking them. 2000-12-01 09:54:42 +00:00
chs 024f8bed4a add new uvmexp fields for uvmexp_print(). 2000-12-01 09:48:56 +00:00
simonb 33999a4224 Move uvm_pgcnt_vnode and uvm_pgcnt_anon into uvmexp (as vnodepages and
anonpages), and add vtextpages which is currently unused but will be
used to trace the number of pages used by vtext vnodes.
2000-11-30 11:04:43 +00:00
simonb 3c1b8a2b35 Add a vm.uvmexp2 sysctl that uses a ABI-safe 'struct uvmexp_sysctl'. 2000-11-29 09:52:18 +00:00
chs e9037d16c5 allow building without SOFTDEP by adding the pageiodone hook to bio_ops. 2000-11-27 18:26:38 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
chs c29a1b4461 allow ports to override PAGER_MAP_SIZE in machine/vmparam.h.
some ports (such as arm32) don't have enough KVA for the
increased default size once the UBC mapping is also present.
2000-11-27 08:19:50 +00:00
chs 1ec37ad27a use queue.h macros and KASSERT(). 2000-11-27 07:47:42 +00:00
nisimura 10571faa84 Introduce uvm_km_valloc_align() and use it to glab process's USPACE
aligned on USPACE boundary in kernel virutal address.  It's benefitial
for MIPS R4000's paired TLB entry design.
2000-11-27 04:36:40 +00:00
chs 2ed28d2c7a lots of cleanup:
use queue.h macros and KASSERT().
address amap offsets in pages instead of bytes.
make amap_ref() and amap_unref() take an amap, offset and length
  instead of a vm_map_entry_t.
improve whitespace and comments.
2000-11-25 06:27:59 +00:00
soren 2a6c823e89 Typo in comment. 2000-11-24 23:30:01 +00:00
chs b5142d6841 increase PAGER_MAP_SIZE to 16MB and move it to uvm_pager.h
since the alpha and mips pmaps use it.
2000-11-24 22:41:38 +00:00
chs f9fb6f5a55 g/c unused pager ops "asyncget" and "aiodone". 2000-11-24 20:34:01 +00:00
chs ccbcd7c873 use queue.h macros and other misc cleanup. 2000-11-24 18:54:31 +00:00
chs 55a751c9d5 add ddb commands "show uvmexp" and "show ncache".
the former used to be "call uvm_dump", the latter is new.
2000-11-24 07:25:50 +00:00
chs 0a54af033a cleanup: use queue.h macros and KASSERT(). 2000-11-24 07:07:27 +00:00
mrg 45d83e5996 add SWAP_GETDUMPDEV command support. 2000-11-17 11:39:39 +00:00
chs 1fd1a318cb in swap_off(), reverse the order of vrele() and VOP_CLOSE() so that
devices will actually be notified if this is the last close.
this allows raidframe swap devices to be marked clean.
also, move the corresponding vref() into swap_on() for symmetry
and improve some comments.
2000-11-13 14:50:55 +00:00
christos 413d7641a1 Give a hint to the user on why we failed. 2000-11-09 19:15:28 +00:00
ad 642267bcc7 Update for hashinit() change. 2000-11-08 14:28:12 +00:00
thorpej 0a2fa5320b Back out rev. 1.83 -- it's causing problems with some pmap
implementations, so we'll have to spend a little more time
working on the problem.
2000-10-16 23:17:54 +00:00
thorpej 76589fafd4 - uvmspace_share(): If p2 has a vmspace already, make sure to deactivate
it and free it as appropriate.  Activate p2's new address space once
  it references p1's.
- uvm_fork(): Make sure the child's vmspace is NULL before calling
  uvmspace_share() (the child doens't have one already in this case).

These changes do not change the behavior for the current use of
uvmspace_share() (vfork(2)), but make it possible for an already
running process (such as a kernel thread) to properly attach to
another process's address space.
2000-10-11 17:27:58 +00:00
thorpej 47a2016cdc - Change SAVE_HINT() to take a "check" value. This value is compared
to the contents of the hint in the map, and the hint saved in the
  map only if the two values match.  When an unconditional save is
  required, the "check" value passed should be map->hint (and the
  compiler will optimize the test away).  When deleting a map entry,
  the new SAVE_HINT() will only change the hint if the entry being
  deleted was the hint value (thus preserving any meaningful hint
  that may have been there previously, rather than stomping on it).
- Add a missing hint update when deleting the map entry in
  uvm_map_entry_unlink().  This is the fix for kern/11125, from
  ITOH Yasufumi <itohy@netbsd.org>.
2000-10-11 17:21:11 +00:00
mrg 4f75145ec1 s/vm/uvm/ in a bunch of error messages. 2000-10-05 00:37:50 +00:00
mrg dd521daa8b clean up a comment. 2000-10-03 20:50:49 +00:00
eeh 1ecf6779be Add support for variable end of user stacks needed to support COMPAT_NETBSD32:
`struct vmspace' has a new field `vm_minsaddr' which is the user TOS.

	PS_STRINGS is deprecated in favor of curproc->p_pstr which is derived
	from `vm_minsaddr'.

	Bump the kernel version number.
2000-09-28 19:05:06 +00:00
enami 9308eaef21 splstatclock is insufficient to protect run queues. Acquire scheduler
lock instead.
2000-09-23 00:43:10 +00:00
thorpej b008f5f25a Make PMAP_PAGEIDLEZERO() return a boolean value. FALSE indidcates
that the page being zero'd was not completed and that page zeroing
should be aborted.  This may be used by machine-dependent code doing
slow page access to reduce the latency of running a process that has
become runnable while in the middle of doing a slow page zero.
2000-09-21 17:46:04 +00:00
thorpej 72a24b4eae Add an align argument to uvm_map() and some callers of that
routine.  Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
2000-09-13 15:00:15 +00:00
chs 11d2a68c1e fix uvm_coredump32() just like uvm_coredump(). 2000-09-07 05:01:43 +00:00
chs db3465f65b in uvm_coredump(), avoid dumping parts of the stack multiple times
while skipping parts of the stack that hasn't been used.
pointed out by SAITOH Masanobu <masanobu@iij.ad.jp>.
2000-08-24 06:09:25 +00:00
thorpej 9bd3060650 Remove a totally unnecessary splhigh/spl0 pair. 2000-08-21 02:29:32 +00:00
bjh21 3e6dc8178c Ensure that uvmexp.freemin is above the kernel reserved-page count.
When it wasn't (which could happen on a 4Mb machine with 32kb pages),
uvm_pagealloc_strat could refuse to allocate user memory, while the pagedaemon
didn't think it was worth freeing any more, resulting in the system seizing up.
2000-08-20 10:24:14 +00:00
thorpej 1b0163bd50 Garbage-collect a constant that nothing uses. 2000-08-16 16:32:06 +00:00
thorpej a91e7a7c6d Don't bother with a trampoline to start the pagedaemon and
reaper threads.
2000-08-12 22:41:53 +00:00
sommerfeld a7449460ec add comment warning about possible unlock/sleep race 2000-08-12 17:46:25 +00:00
sommerfeld 41c6473b10 Use ltsleep in a loop instead of simple_unlock/tsleep/goto try_again 2000-08-12 17:44:02 +00:00
thorpej 6eb78dcb4e Update a comment in uvmfault_anonget() to reflect reality, and
make uvm_fault() handle uvmfault_anonget() failure properly (i.e.
don't unlock a lock that's already unlocked).
2000-08-06 00:22:53 +00:00
thorpej 93a5993242 Do something sane with a DIAGNOSTIC condition in an non-DIAGNOSTIC
kernel.
2000-08-06 00:21:57 +00:00
thorpej 504f88949c Correct a comment about locking wrt. uvmfault_anonget(). 2000-08-05 23:40:55 +00:00
thorpej d3a2c5d0f9 MALLOC()/FREE() are not to be used for variable size allocations. 2000-08-03 00:47:02 +00:00
thorpej d85e53c7cc MALLOC() is not to be used for variable-sized allocations. 2000-08-02 20:25:11 +00:00
thorpej a09c11603b MALLOC()/FREE() are not to be used for variable-sized allocations. 2000-08-02 20:23:23 +00:00
thorpej 72fa880bf6 Fix a fairly obvious locking error in amap_cow_now() -- the amap was
left locked upon exit from the function (how did this one slip for
so long?)
2000-08-02 19:24:29 +00:00
wiz be8ff811b7 Rename VM_INHERIT_* to MAP_INHERIT_* and move them to sys/sys/mman.h as
discussed on tech-kern.
Retire sys/uvm/uvm_inherit.h, update man page for minherit(2).
2000-08-01 00:53:07 +00:00
jeffs 05dfa34e69 Add uvm_km_valloc_prefer_wait(). Used to valloc with the passed in
voff_t being passed to PMAP_PREFER(), which results in the propper
virtual alignment of the allocated space.
2000-07-24 20:10:51 +00:00
mrg 5b2b68bb7a fix a cast for sparc64. 2000-07-10 13:37:00 +00:00
thorpej 1079b4c0ac - Avoid an integer overflow when checking if we have exceeded our
rlimit in sbrk.  Slightly modified from a patch from Artur Grabowski.
- Rearrange code slightly, partially from Artur Grabowski.
- Only adjust vm_dsize if the grow or shrink actually succeeds.
2000-07-02 17:40:08 +00:00
mrg dea44a9ec4 remove include of <vm/vm.h> 2000-06-27 17:29:17 +00:00
mrg 1f4b948b2f move the contents of <vm/vm.h> into <uvm/uvm_extern.h>. <vm/vm.h> is simply
an include of <uvm/uvm_extern.h> now.
2000-06-27 16:16:43 +00:00
mrg 88adda1288 more vm header file changes:
<vm/vm_extern.h> merged into <uvm/uvm_extern.h>
	<vm/vm_page.h> merged into <uvm/uvm_page.h>
	<vm/pmap.h> has become <uvm/uvm_pmap.h>

this leaves just <vm/vm.h> in NetBSD.
2000-06-27 09:00:14 +00:00
mrg cd9f783cb9 install uvm_pmap.h 2000-06-27 08:49:44 +00:00
simonb eeff58b5fd In udv_fault(), use an off_t for curr_offset so that the offset passed
to d_mmap isn't truncated on 64 bit architectures.
2000-06-27 06:14:24 +00:00
mrg 6b5536f253 restore a dropped #ifdef _KERNEL 2000-06-26 17:18:40 +00:00
mrg acdc45ce9a install uvm_param.h. 2000-06-26 17:01:34 +00:00
mrg 7665599771 <vm/vm_map.h> gets merged into <uvm/uvm_map.h> 2000-06-26 15:32:23 +00:00
mrg 4c698e84f6 <vm/vm_param.h> -> <uvm/uvm_param.h> 2000-06-26 14:58:58 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
simonb 889c658b5b Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes.  Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
2000-06-26 04:55:19 +00:00
mrg f5f84f80c5 <vm/vm_prot.h> becomes <uvm/uvm_prot.h> 2000-06-25 13:37:51 +00:00
pk d3aef3ad38 uvm_detach: eliminate degenerate loop construction. 2000-06-24 21:47:28 +00:00
pk bdee69596e Insert two missing `simple_unlock()'s' in udv_detach(). 2000-06-24 21:26:16 +00:00
simonb 58d0ed9dd2 Set p->p_addr to NULL after it gets freed. 2000-06-18 05:20:27 +00:00
chs e72214422a initialize aref.ar_pageoff even if there's no amap. 2000-06-13 04:10:47 +00:00
soda d5b3fb3ce1 fix printf format mismatch, when paddr_t becomes (long long) on arc port. 2000-06-09 04:43:19 +00:00
thorpej b0afc900f5 Change UVM_UNLOCK_AND_WAIT() to use ltsleep() (it is now atomic, as
advertised).  Garbage-collect uvm_sleep().
2000-06-08 05:52:34 +00:00
pk 36a1354bc6 Change previous to use `vm_map_min(dstmap)' instead of hard-coding
VM_MIN_KERNEL_ADDRESS.
2000-06-05 07:28:56 +00:00
pk 51ff5f7cd1 Let uvm_map_extract() set the lower bound on the kernel address range
itself, in stead of having its callers do that.
2000-06-02 12:02:43 +00:00
pk bf3a6b350b Shouldn't pass garbage to uvm_map_extract(). 2000-06-02 11:47:53 +00:00
thorpej 65184f2470 Change the comment before the vm_page_zero_enable global to indicate
what it will now be used for.
2000-05-29 19:25:56 +00:00
drochner f8a6b48d66 Don't silently truncate the voff_t offset to vaddr_t when passing it to
udv_attach. Pass the whole voff_t instead and do an explicite overflow
check before it is passed to the device's mmap handler (as "int", sadly).
2000-05-28 10:21:55 +00:00
thorpej e03e9e8086 Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1().  In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
2000-05-28 05:48:59 +00:00
thorpej a7d0570e67 First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

	- Global state: sched_qs (run queues), sched_whichqs (bitmap
	  of non-empty run queues), sched_slpque (sleep queues).
	  NOTE: These may collectively move into a struct schedstate
	  at some point in the future.

	- Per-CPU state, struct schedstate_percpu: spc_runtime
	  (time process on this CPU started running), spc_flags
	  (replaces struct proc's p_schedflags), and
	  spc_curpriority (usrpri of processes on this CPU).

	- Every platform must now supply a struct cpu_info and
	  a curcpu() macro.  Simplify existing cpu_info declarations
	  where appropriate.

	- All references to per-CPU scheduler state now made through
	  curcpu().  NOTE: this will likely be adjusted in the future
	  after further changes to struct proc are made.

Tested on i386 and Alpha.  Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
2000-05-26 21:19:19 +00:00
thorpej 8964c35eca Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor.  Test against SONPROC as appropriate rather than
combinations of SRUN and curproc.  Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.
2000-05-26 00:36:42 +00:00
enami 332c98526a - Move the comment, which describes that calling the function
uvm_map_pageable(map, ...) implies unlocking passed map, just before the
  function call.
- If we bail out before calling the uvm_map_pageable, unlock the map
  by ourself to prevent a panic ``locking against myself''.  The panic is,
  for example, caused when cdrecord is invoked with too large fifo size.
2000-05-23 02:19:20 +00:00
thorpej 1410091b4e Clean up a comment. 2000-05-20 19:54:01 +00:00
thorpej cd737c4016 Remove VM_PROT_EXECUTE from the permissions used to map the page
for pager I/O -- it is not needed, and including it leads to
unnecessary I-cache flushes.
2000-05-20 03:36:06 +00:00
thorpej 646555bbd5 Clean up some indentation lossage in uvm_map_extract(). 2000-05-19 17:43:55 +00:00
thorpej f636538446 NULL != 0 2000-05-19 04:34:39 +00:00
thorpej 655b21e17d Tell uvm_pagermapin() the direction of the I/O so that it can map
with only the protection that it needs.
2000-05-19 03:45:04 +00:00
thorpej f3b078d268 __predict_false() an error check. 2000-05-08 23:13:42 +00:00
thorpej d45c9982df __predict_false() DIAGNOSTIC error checks. 2000-05-08 23:11:53 +00:00
thorpej 39294d89e5 __predict_false() out-of-resource conditions and DIAGNOSTIC error checks. 2000-05-08 23:10:20 +00:00
thorpej b5b82faa4a uvm_map_setup(): We almost ever set up an interrupt-safe map, but we
set up quite a few regular ones (at every fork!), so put interrupt-
safe map setup in the slow path with a __predict_false().

uvm_map_reference(): __predict_false() the check for NULL map.
uvm_map_deallocate(): Likewise.
2000-05-08 22:59:35 +00:00
thorpej 9ec517a68e Changes necessary to implement pre-zero'ing of pages in the idle loop:
- Make page free lists have two actual queues: known-zero pages and
  pages with unknown contents.
- Implement uvm_pageidlezero().  This function attempts to zero up to
  the target number of pages until the target has been reached (currently
  target is `all free pages') or until whichqs becomes non-zero (indicating
  that a process is ready to run).
- Define a new hook for the pmap module for pre-zero'ing pages.  This is
  used to zero the pages using uncached access.  This allows us to zero
  as many pages as we want without polluting the cache.

In order to use this feature, each platform must add the appropropriate
glue in their idle loop.
2000-04-24 17:12:00 +00:00
chs d444bb4032 undo rev 1.13, which is to say, don't block interrupts while deactivating
one pmap and activating another.  this isn't actually necessary (since
pmap_activate() and pmap_deactivate() affect only user-level mappings,
which cannot be accessed from interrupts anyway), and pmap_activate()
is very slow on old sun4c sparcs so we can't block interrupts for this long.
this fixes PR 8322.
2000-04-16 20:52:29 +00:00
mrg 6b7f13609a remove <vm/vm_swap.h> and <vm/vm_conf.h> 2000-04-15 18:08:12 +00:00
pk 741c324930 Finish previous. 2000-04-11 08:12:14 +00:00
chs 8724ec3b5c avoid declarating "i" as a local variable in a macro.
it's too easy to shadow another local.
2000-04-11 02:34:19 +00:00
chs 66014d2dff sparc -> __sparc__
print lock status in uvm_object_printit().
2000-04-10 02:21:26 +00:00
chs 061ecbff46 tidy. 2000-04-10 02:20:06 +00:00
thorpej eeb3a38cfc Use UVM_PGA_ZERO in the promote-zero-fault case of uvm_fault(). 2000-04-10 01:17:41 +00:00
thorpej 345b3d2136 Use UVM_PGA_ZERO in a few (easy) places. 2000-04-10 00:32:46 +00:00
thorpej 2c48131727 Add UVM_PGA_ZERO which instructs uvm_pagealloc{,_strat}() to return a
zero'd, ! PG_CLEAN page, as if it were uvm_pagezero()'d.
2000-04-10 00:28:05 +00:00
chs d75d6fb164 restore a brelvp() that I removed in a moment of overzealousness.
Debugged by:  Brian Grayson <bgrayson@netbsd.org>
2000-04-07 08:27:28 +00:00
chs 60a7a67f71 remove uvm_shareprot(). no longer needed since the demise of share maps. 2000-04-03 08:09:02 +00:00
chs 03a4ef3a79 remove the "shareprot" pagerop. it's not needed anymore since
share maps are long gone.
2000-04-03 07:35:23 +00:00
thorpej 2bc5adb20e Instead of checking vm_physmem[<physseg>].pgs to determine if
uvm_page_init() has completed, add a boolean uvm.page_init_done,
and test against that.  Use this same boolean (rather than
pmap_initialized) in pmap_growkernel() to determine if we are
being called via uvm_page_init() to grow the kernel address space.

This fixes a problem on some i386 configurations where pmap_init()
itself was needing to have the kernel page table grown, and since
pmap_initialized was not yet set to TRUE, pmap_growkernel() was
choosing the wrong code path.

Fix tested by Havard Eidnes.
2000-04-02 20:39:14 +00:00
augustss 641df97d12 Remove more register declarations. 2000-03-30 12:31:50 +00:00
simonb 171910636e Delete redundant decl of aobj_pager - it's in <uvm/uvm_aobj.h>. 2000-03-30 02:49:55 +00:00
simonb b2a7dc176d Remove redundant decl for uvmspace_fork() - it's in <uvm/uvm_extern.h>. 2000-03-29 04:05:47 +00:00
simonb 0fd09c8496 Don't need to include <sys/conf.h> here. 2000-03-29 03:43:33 +00:00
kleink 7e35a43e67 In mmap(), bail out with EOVERFLOW when mapping a regular file and the file
offset plus mapping length cannot be represented in an off_t.
2000-03-28 18:45:19 +00:00
kleink a51ef2c3f9 Kill duplicate uvn_attach() prototype (public, already in uvm_vnode.h). 2000-03-27 16:58:23 +00:00
kleink 6e5b64c8a0 Merge parts of chs-ubc2 into the trunk:
Add a new type voff_t (defined as a synonym for off_t) to describe offsets
into uvm objects, and update the appropriate interfaces to use it, the
most visible effect being the ability to mmap() file offsets beyond
the range of a vaddr_t.

Originally by Chuck Silvers; blame me for problems caused by merging this
into non-UBC.
2000-03-26 20:54:45 +00:00
kleink 08025fbc20 Kill duplicate udv_attach() prototype; it's a public interface, and declared
in uvm_device.h.
2000-03-26 20:46:59 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
thorpej 9671588a30 Allocate the page buckets out of kernel_map, not kmem_map. Saves 16
or so kmem_map pages on a 32MB SPARCstation 2.
2000-02-13 03:34:40 +00:00
thorpej eb9cbbe294 Add some very simple code to auto-size the kmem_map. We take the
amount of physical memory, divide it by 4, and then allow machine
dependent code to place upper and lower bounds on the size.  Export
the computed value to userspace via the new "vm.nkmempages" sysctl.

NKMEMCLUSTERS is now deprecated and will generate an error if you
attempt to use it.  The new option, should you choose to use it,
is called NKMEMPAGES, and two new options NKMEMPAGES_MIN and
NKMEMPAGES_MAX allow the user to configure the bounds in the kernel
config file.
2000-02-11 19:22:52 +00:00
thorpej fe551f0e64 Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle.  Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
2000-02-07 20:16:47 +00:00
chs 26c744c85b remove a debug printf that has outlived its usefulness. 2000-01-28 08:02:48 +00:00
thorpej 0b0aecffd6 Update for sys/buf.h/disksort_*() changes. 2000-01-21 23:43:10 +00:00
chs 16f0ca3612 add support for ``swapctl -d'' (removing swap space).
improve handling of i/o errors in swap space.

reviewed by:  Chuck Cranor
2000-01-11 06:57:49 +00:00
wrstuden 56f2ef9f29 Revert rev 1.28 -> 1.29. The VOP_CLOSE call was happeneing with the vnode
already locked, so don't lock it here.
2000-01-04 21:37:54 +00:00
eeh c0ac678704 I should have made uvm_page_physload() take paddr_t's instead of vaddr_t's.
Also, add uvm_coredump32().
1999-12-30 16:09:47 +00:00
thorpej 7287dd22c6 Remove a piece of code introduced in rev 1.36 that I didn't intend to
commit.
1999-12-11 05:38:41 +00:00
fvdl 5277c5e448 CL* clearout 1999-12-04 23:14:40 +00:00
drochner 38e73c0c99 in uvm_page_physget(), try the vm_physmem[] chunks in the order of their
"free_list" attributes, to save DMA memory
1999-12-01 16:08:32 +00:00
thorpej 63494b0b50 Avoid an integer overflow on systems w/ more than 2G of RAM. 1999-11-30 18:34:23 +00:00
drochner b1f2453dee add a diagnostic panic to catch illegal memory ranges passed to
uvm_page_physload()
1999-11-24 18:28:49 +00:00
fvdl 0b1963121a Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
1999-11-15 18:49:07 +00:00
thorpej 1da427a80a Change the pmap_enter() API slightly; pmap_enter() now returns an error
value (KERN_SUCCESS or KERN_RESOURCE_SHORTAGE) indicating if it succeeded
or failed.  Change the `wired' and `access_type' arguments to a single
`flags' argument, which includes the access type, and flags:

	PMAP_WIRED	the old `wired' boolean
	PMAP_CANFAIL	pmap_enter() is allowed to fail

If PMAP_CANFAIL is not specified, the pmap should behave as it always
has in the face of a drastic resource shortage: fall over dead.

Change the fault handler to deal with failure (which indicates resource
shortage) by unlocking everything, waiting for the pagedaemon to free
more memory, then retrying the fault.
1999-11-13 00:24:38 +00:00
thorpej a25b1ab916 Always pass all arguments to uvm_sleep(). 1999-11-13 00:21:17 +00:00
thorpej 8e930a51fe Const poison uvm_wait(). 1999-11-04 21:51:42 +00:00
ross 0f2e70dfa4 Patch from chuq for uvm r/w map oscillation bug.
Fixes the XalphaNetBSD slowdown.
1999-10-24 16:29:23 +00:00
chs b16ae5a8a5 put various debugging printfs under #ifdef DEBUG. 1999-10-19 16:04:45 +00:00
wrstuden e682a080e9 In spec_close(), if we're not doing a non-blocking close and VXLOCK is
not set, unlock the vnode before calling the device's close routine and
relock it after it returns. tty close routines will sleep waiting for
buffers to drain, which won't happen often times as the other side needs
to grab the vnode lock first.

Make all unmount routines lock the device vnode before calling VOP_CLOSE().
1999-10-16 23:53:26 +00:00
chs f3a668ed84 eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
1999-09-12 01:16:55 +00:00
thorpej 23e83a7ac7 When handling the MADV_FREE case, if the amap or aobj has more than
one reference, go through the deactivate path; the page may actually
be in use by another process.

Fixes kern/8239.
1999-08-21 02:19:05 +00:00