Commit Graph

1086 Commits

Author SHA1 Message Date
drochner e10923fd37 -clean up the interface to uvm_fault: the "fault type" didn't serve
any purpose (done by a macro, so we don't save any cycles for now)
-kill vm_fault_t; it is not needed for real faults, and for simulated
 faults (wiring) it can be replaced by UVM internal flags
-remove <uvm/uvm_fault.h> from uvm_extern.h again
2006-03-15 18:09:25 +00:00
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
drochner 2d1a0b57b6 kill the "fault_type" argument to pager's pgo_fault() methods
it is never used
(and using it would comprise an abstraction violation imho)
2006-02-22 22:28:18 +00:00
bjh21 0638b201c9 Include page ownership information in the output of the DDB "show all pages"
command if UVM_PAGE_TRKOWN is enabled.
2006-02-22 22:20:56 +00:00
bjh21 ed2f09f139 Add a "show all pages" command to DDB which prints one line per physical
page in the system.  Useful for getting some idea where all your memory's
gone, at least on a sufficiently small system.
2006-02-19 18:52:29 +00:00
perry fbae48b901 Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
2006-02-16 20:17:12 +00:00
yamt 9040ed946b - amap_copy: take a "flags" argument instead of booleans.
- add AMAP_COPY_NOMERGE flag, and use it for uvm_map_extract.
  PR/32806 from Julio M. Merino Vidal.
2006-02-15 14:06:45 +00:00
yamt f382834c1a share some code between uvmpd_scan_inactive and uvmpd_scan. 2006-02-14 15:06:27 +00:00
yamt 16f42c29a4 fix a compilation problem where PAGE_SHIFT is not a constant.
pointed by Chuck Silvers.
2006-02-14 02:28:21 +00:00
yamt e6e15660e2 remove an outdated comment. 2006-02-13 14:41:22 +00:00
yamt 62eb3a15e1 factor out swap clustering code. 2006-02-12 09:19:59 +00:00
yamt 2a89e06daa uvm_pageunwire: use uvm_pageactivate rather than a copy. 2006-02-12 09:19:27 +00:00
yamt a3af4c1530 remove the following options. no objections on tech-kern@.
UVM_PAGER_INLINE
	UVM_AMAP_INLINE
	UVM_PAGE_INLINE
	UVM_MAP_INLINE
2006-02-11 12:45:07 +00:00
simonb 8b00a8c689 Make a note that some counters should be 64-bit as they wrap far to
quickly.
2006-02-10 00:53:04 +00:00
yamt acb669a7cf handle "strange" filesystems like layered filesystems and tmpfs,
where pgo_get returns pages which don't belong to the uobj.
also fix an XXX in uvm_loananon and lock-unlock mismatch in uvm_loanuobj.

PR/28372, PR/32665 (Alan Barrett).
2006-01-31 14:11:25 +00:00
yamt 43ed84382c re-apply uvm_fault.c 1.104. fixes will follow. 2006-01-31 14:05:47 +00:00
yamt f03efb066e uvm_mremap: whitespace. 2006-01-31 14:03:53 +00:00
yamt 7fcddedf0b revert uvm_fault.c 1.104 for now. see PR/28372, PR/32665. 2006-01-30 11:50:17 +00:00
yamt f67f4b05f1 uvm_mremap: fix "easy cases". 2006-01-23 07:53:01 +00:00
matt 7db3afd210 Fix u_int64_t -> uint64_t stragglers. 2006-01-21 18:57:45 +00:00
yamt e8e7ab8637 implement compat_linux mremap. 2006-01-21 13:34:15 +00:00
yamt 651bed2a01 - uvm_fault: move a common code of 1B and 2B to a new function.
don't attempt to allocate anons with kernel_map locked.  PR/32543.
- amap_copy: add an assertion.
2006-01-21 13:13:07 +00:00
yamt 5865f6ed1d uvm_map_replace: remove a wrong comment. 2006-01-21 13:10:41 +00:00
chs 5570661cd8 in amap_alloc(), only put the amap on the list of amaps if we succeeded
in allocating it.
2006-01-18 17:03:36 +00:00
yamt b88fc0e1b7 make some debug statistics evcnt. 2006-01-15 08:31:31 +00:00
yamt 37dd42949a clean up uvm_map evcnt code. no functional changes. 2006-01-08 09:18:27 +00:00
yamt dc9b2af242 uvmpd_scan_inactive: when reactivating a page,
use pmap_is_referenced rather than pmap_clear_reference.
we don't need to clear the bit here as we'll do so when
moving pages back to inactive queue again.  pointed by Chuck Silvers.
2006-01-05 10:47:33 +00:00
yamt 690d424f28 - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
2006-01-04 10:13:05 +00:00
perry 3d4ed1fbc7 __inline__ -> inline 2005-12-24 23:41:33 +00:00
perry 0f0296d88a Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:45:08 +00:00
yamt 2b91131918 uao_get: don't mark pages dirty unless it's a write fault. 2005-12-24 13:22:13 +00:00
yamt 79265831ba uvmpd_scan: when deactivating a page, clear its reference bit.
discussed on tech-kern@.
2005-12-21 12:24:47 +00:00
yamt ca08761347 whitespace in SYSCTL_DESCR. 2005-12-21 12:23:44 +00:00
yamt 4fce5d6f5e make length of inactive queue tunable by sysctl. (vm.inactivepct) 2005-12-21 12:19:04 +00:00
skrll dd1a604b66 Whitespace 2005-12-20 08:25:58 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
chs b794108bfa Avoid leaking memory if uiomove fails. from openbsd via PR 32251. 2005-12-06 16:01:13 +00:00
yamt ebf0820ef4 uao_pagein_page: pass PGO_SYNCIO to uao_get.
uao_get doesn't always assume PGO_SYNCIO after yamt-readahead merge.

reported and a dump provided by Masanori Kanaoka.
2005-12-05 01:24:07 +00:00
yamt b09859311d add files i forgot to add when merging yamt-readahead branch. 2005-11-29 23:37:59 +00:00
yamt 221616873d merge yamt-readahead branch. 2005-11-29 22:52:02 +00:00
yamt 52f0a62851 read-ahead statistics. 2005-11-29 15:45:28 +00:00
thorpej ff810990b2 Move UVM files to files.uvm 2005-11-27 22:18:41 +00:00
simonb 155c8bd666 Whitespace nit. 2005-11-09 12:47:39 +00:00
yamt 9df1f09b91 add a function to drop all swap slots in a given range. for tmpfs.
XXX maybe it's better to implement true truncation.
2005-11-08 23:02:22 +00:00
chs 5332333501 in amap_cow_now(), handle the case where we have to sleep and some of the
already-copied pages are paged out.  anons that have already been copied
will have refcount == 1, whereas anons that still need to be copied will
have refcount > 1.  fixes PR 25392, PR 30257, PR 31924.
2005-11-06 15:57:32 +00:00
yamt 94ce3d822f don't include uvm_*_i.h unless needed,
to reduce bogus header dependencies.
2005-10-30 11:56:51 +00:00
chs da3f825c26 remove the assertion in uvm_swapout_threads() about LSONPROC lwps
not running on the same CPU as the swapper.  l_stat is protected by
sched_lock, which isn't held here, so we can race with that lwp
starting to run and see its l_cpu not updated yet, as in PR 31870.
we check l_stat again in uvm_swapout() while holding sched_lock,
so the race itself is harmless.
2005-10-24 00:26:37 +00:00
yamt aec75b1cc6 - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
  have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
  from sys/bufq.h to sys/bufq_impl.h.
  (is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c.  (not tested)
2005-10-15 17:29:10 +00:00
chs 9307d68e6a stop converting async msync() to sync.
this hasn't been needed for years (if it ever was).
2005-10-10 15:53:28 +00:00
yamt bddc9e47fe add a file which i forgot when reviving VMSWAP option. 2005-09-21 10:21:46 +00:00
yamt b63b4e8324 - make uvm_swap_stats acquire swap_syscall_lock by itsself
so that callers don't need to acquire it beforehand.
- make swap_syscall_lock static.
2005-09-17 14:51:50 +00:00
yamt d597202302 make VMSWAP optional again. 2005-09-17 14:38:38 +00:00
yamt 1f6a8b12c5 uao_put: don't skip loaned or wired pages. 2005-09-14 20:25:21 +00:00
yamt 6fbf5bf6f1 wrap swap related code by #ifdef VMSWAP. always #define VMSWAP for now. 2005-09-13 22:00:05 +00:00
yamt 873763ea0f uao_put: recognize endoff == 0 as "to the end of the object",
as VOP_PUTPAGES (thus vnode pager) does.  for tmpfs.
2005-09-13 19:54:09 +00:00
yamt 74be61b2e6 remove one of duplicated forward decl. of vmspace. pointed by Dheeraj S. 2005-09-01 02:21:12 +00:00
yamt b34f62d5e9 put back uvm_fault.h for now as it's needed for some ports. 2005-09-01 02:16:46 +00:00
yamt be5d1db4a4 don't include uvm_fault.h unnecessarily. 2005-08-27 16:11:32 +00:00
yamt 38ca5312d2 revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
2005-07-31 04:04:30 +00:00
yamt 1d0891101c defflag VMSWAP. 2005-07-30 06:33:33 +00:00
yamt b7bfe82866 update file timestamps for nfsd loaned-read and mmap.
PR/25279.  discussed on tech-kern@.
2005-07-23 12:18:41 +00:00
yamt 62cab9eab7 uvm_fault: check a correct object in the case of layered filesystems.
fix PR/30811 from Jukka Salmi.
2005-07-22 14:57:39 +00:00
yamt 8af42d8d3c ensure that vnodes with dirty pages are always on syncer's queue.
- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
  setting "wasclean" false when encountering them.
  suggested by Stephan Uphoff in PR/24596 (1).

- genfs_putpages: write protect pages when cleaning out, if
  we're going to take the vnode off the syncer's queue.
  uvm_fault: don't write-map pages unless its vnode is already on
  the syncer's queue.

  fix PR/24596 (3) but in the different way from the suggested fix.
  (to keep our current behaviour, ie. not to require explicit msync.
  discussed on tech-kern@.)

- genfs_putpages: don't mistakenly take a vnode off the queue
  by introducing a generation number in genfs_node.
  genfs_getpages: increment the generation number.
  suggested by Stephan Uphoff in PR/24596 (2).

- add some assertions.
2005-07-17 12:27:47 +00:00
yamt 2a6dc9d02d - introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
  page size > block size.

- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
  VM_PROT_READ.
2005-07-17 09:13:35 +00:00
thorpej 5303f3b378 Clean up the cpp macro used to say "we're compiling this specific C file". 2005-06-28 05:25:42 +00:00
thorpej 9057ed7600 Make a note about why a large function like uvm_loanentry() can be
an inline in this case.
2005-06-28 04:06:52 +00:00
thorpej 8d3ff810fa Add missing PAGE_INLINE to uvm_pagelookup() 2005-06-28 04:00:07 +00:00
thorpej fcd6584a58 Clean up the use of __inline in this file. In particular, don't inline
really big chunks of code.  This saves almost 2.5K on a GENERIC i386
kernel, and has the added benefit of not polluting the I$ so much.
2005-06-28 01:07:56 +00:00
thorpej b651fb886d Sprinkle some static. 2005-06-27 02:29:32 +00:00
thorpej 154a970ff4 Small whitespace tweak. 2005-06-27 02:23:26 +00:00
thorpej e569facced Use ANSI function decls. 2005-06-27 02:19:48 +00:00
jmc 1786cf4f46 Change signature of uvm_kmapent_map defintiion to __INLINE to match prototype 2005-06-13 20:39:14 +00:00
dsl d68ddde829 If we are builging a small kernel [1], don't inline all these functions.
Saves over 2k and lets i386 rescue_tiny build again.
[1] if MALLOC_NOINLINE is defined - not ideal but...
2005-06-10 22:00:52 +00:00
matt e1245a3c46 Rework the coredump code to have no explicit knownledge of how coredump
i/o is done.  Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o.  This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
2005-06-10 05:10:12 +00:00
matt bb583a82ce Make sure state.end has a valid initial value. 2005-06-07 22:02:48 +00:00
yamt 11bfc2d8e1 introduce a macro to initialize uvm_object and use it. 2005-06-06 12:09:19 +00:00
chs 48e4eb59a3 adapt to const changes. 2005-06-04 13:48:35 +00:00
matt 25a0e29a75 When writing coredumps, don't write zero uninstantiated demand-zero pages.
Also, with ELF core dumps, trim trailing zeroes from sections.  These two
changes can shrink coredumps by over 50% in size.
2005-06-02 17:01:43 +00:00
drochner d481be4d04 prepend an underscore to local variables in macros, to avoid shadowing
user defined ones
2005-06-01 18:03:50 +00:00
christos e715d2ee98 avoid shadow variables.
remove unneeded casts.
2005-05-29 21:06:33 +00:00
yamt faf63ba09b uvm_kmapent_free: add missing vm_map_lock/unlock. 2005-05-22 21:37:56 +00:00
yamt ea66ccc0a5 uvm_mapent_trymerge: adjust object offset when necessary. 2005-05-18 01:36:16 +00:00
yamt 9dcbe8b85f redo the previous (uvm_map.c rev.1.195) correctly. 2005-05-18 01:34:53 +00:00
yamt 1d028221a3 uvm_mapent_trymerge: add missing checks. 2005-05-17 21:45:24 +00:00
yamt 50a25acc50 (try to) merge map entries in fault handler. 2005-05-17 13:55:33 +00:00
yamt 1e5d4510fa revert uvm_map.c rev.1.190 in favor of merging in fault handler. 2005-05-17 13:54:19 +00:00
yamt 627b0d5099 remove anon related statistics which are no longer used. 2005-05-15 08:01:06 +00:00
yamt 662ada8f7a allocate anons on-demand, rather than reserving static amount of
them on boot/swapon.
2005-05-11 13:02:25 +00:00
nathanw 92279c692f uvm_coredump_walkmap(): Set UVM_COREDUMP_NODUMP on regions whose
protection does not include VM_PROT_READ, so that the core dumping
doesn't error out with EFAULT when trying to write that region.

Addresses PR kern/30143; approach suggested by chs@.
2005-05-06 19:34:47 +00:00
yamt ae24d5d705 - amap_extend: don't extend amap beyond UVM_AMAP_LARGE.
- uvm_map_enter: if we fail to extend amap, just give up merging instead of
  bailing out immediately.
2005-05-05 01:58:51 +00:00
yamt 192e24a575 uvm_reclaimable: add an XXX comment. 2005-05-04 23:23:28 +00:00
yamt 9aacd16106 uvm_map_enter: don't bother to defer amap allocation if there's a mergable
existing entry.  although there're merits and demerits, i think it benefits
common cases.
2005-04-29 09:05:21 +00:00
yamt 1e67869b4b uvm_map: don't leak a preallocated map entry on error. 2005-04-28 14:40:43 +00:00
yamt 7f37519f2c uvmfault_anonget: check uvm_reclaimable() where appropriate. 2005-04-27 15:19:17 +00:00
yamt 4c61e81438 uvmexp_print: print swpgavail as well. 2005-04-27 11:02:43 +00:00
simonb eddbeffa06 Use a cast to (long long) and 0x%llx to print out a paddr_t instead
of casting to (void *).  Fixes compile problems with 64-bit paddr_t
on 32-bit platforms.
2005-04-20 14:10:03 +00:00
yamt 01c07ef7bd fix unreasonably frequent "killed: out of swap" on systems which have
little or no swap.
- even on a severe swap shortage, if we have some amount of file-backed pages,
  don't bother to kill processes.
- if all pages in queue will be likely reactivated, just give up
  page type balancing rather than spinning unnecessarily.
2005-04-12 13:11:45 +00:00
dbj 2939014883 use voff_t instead of vaddr_t to hold file offset passed to pgo_put 2005-04-07 06:44:15 +00:00
yamt a7cd6f7a0e amap_wipeout: remove a comment which is no longer true.
despite of what comment said, i left preempt() call
because i don't think of any bad effects.
2005-04-06 13:58:40 +00:00
yamt b02ae403bb switch swap space allocation code to use blist instead of extent(9).
fix "warning: resource shortage: %d pages of swap lost".

extent(9) has some undesirable characteristics for swap allocation:
	- it involves alloc-to-free.
	- its operational cost is O(n*n) where n is number of entries.
2005-04-06 13:51:33 +00:00
yamt cde0e21683 unwrap short lines. 2005-04-01 12:37:27 +00:00
yamt 6b2d8b66a4 merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
  save some resources like pv_entry.  also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
2005-04-01 11:59:21 +00:00
fvdl c487efe4a7 Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
  that will return the default VM map address. The default function
  is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
  macro. This gives emulations control over the default map address,
  and allows things to be mapped at the right address (in 32bit range)
  for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
  or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
  instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
2005-03-26 05:12:34 +00:00
chs 6e3fb7b0d2 add back rev. 1.29 of vm/vm_map.c, which was apparently lost in the UVM merge:
msync(MS_INVALIDATE) should fail if any part of the region is wired.
2005-02-28 16:55:54 +00:00
chs 64d6a08278 use TRUE and FALSE instead of 1 and 0 for boolean_t. 2005-02-28 15:33:04 +00:00
chs 81a6b7303b add some locking assertions. 2005-02-28 15:31:04 +00:00
perry bcfcddbac1 nuke trailing whitespace 2005-02-26 22:31:44 +00:00
chs 467487d274 use vm_map_{min,max}() instead of dereferencing the vm_map pointer directly.
define and use vm_map_set{min,max}() for modifying these values.
remove the {min,max}_offset aliases for these vm_map fields to be more
namespace-friendly.  PR 26475.
2005-02-11 02:12:03 +00:00
yamt a8acd82f94 update a comment; malloc doesn't use uvm_kernacc anymore. 2005-02-08 08:22:37 +00:00
yamt 9fe116ce3a uvm_fault: fix integer overflow so that MADV_SEQUENTIAL
can work on large files.
2005-02-07 11:57:38 +00:00
chs 6390d0aeca hack around a UVM problem that causes hangs when large processes fork.
see PR 26908 for details.
2005-01-30 17:23:05 +00:00
chs ad79fc3015 move the call to link_pool_init() to the end of uvm_init(). needed for sun3. 2005-01-23 19:02:02 +00:00
chs b0c54c738d pmap_wired_count() is now available on all platforms,
remove the code for the case where it's not defined.
2005-01-23 15:58:13 +00:00
chs 7c203c91d4 reduce the size of user coredump files by not dumping regions of
the address space that have never been touched (such as much of the
virtual space allocated for pthread stacks).
2005-01-21 03:24:40 +00:00
atatat a076957818 Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
2005-01-17 04:37:20 +00:00
yamt b855149311 remove no longer needed #include. 2005-01-16 06:48:38 +00:00
chs a877481d76 deal with alpha's architectural failing of not being able to operate on
memory quantities smaller than 32 bits.
2005-01-15 15:10:49 +00:00
yamt 3068e2f45a don't use uvm_kmapent_alloc for non-intrsafe kernel submaps
(namely exec_map and phys_map) becuase:
- normal vmmpepl is fine for them.
- some of them are tightly sized.  eg. size of exec_map on vax is just NCARGS.

should fix vax boot failure reported by Johnny Billquist on current-users@.
2005-01-14 14:25:40 +00:00
yamt 22099ab744 in uvm_unmap_remove, always wakeup va waiters if any.
uvm_km_free_wakeup is now a synonym of uvm_km_free.
2005-01-13 11:50:32 +00:00
yamt e4666bf785 don't reserve (uvm_mapent_reserve) entries for malloc/pool backends
because it isn't necessary or safe.
reported and tested by Denis Lagno.  PR/28897.
2005-01-12 09:34:35 +00:00
chs 8975a0856f adjust the UBC mapping code to support non-vnode uvm_objects.
this means we can no longer look at the vnode size to determine how many
pages to request in a fault, which is good since for NFS the size can change
out from under us on the server anyway.  there's also a new flag UBC_UNMAP
for ubc_release(), so that the file system code can make the decision about
whether to cache mappings for files being used as executables.
2005-01-09 16:42:43 +00:00
yamt 22cf117f61 km_vacache_alloc: UVM_PROT_ALL rather than UVM_PROT_NONE
so that uvm_kernacc works.  PR/28861. (FUKAUMI Naoki)
2005-01-05 00:58:57 +00:00
yamt 546bb99833 reapply uvm_map.c rev.1.156 (use a zero-sized array instead of
c99 flexible array member) for ports which still use gcc 2.95.
from Havard Eidnes.
2005-01-03 19:46:22 +00:00
yamt 0c5ceb72e4 km_vacache_alloc: specify va hint correctly rather than
using stack garbage.  PR/28845.
2005-01-03 04:01:13 +00:00
yamt 3983ffcfb1 uvm_unmap_remove: debug check to ensure that
unmapped regions doesn't have any remaining page mappings.
2005-01-01 21:12:59 +00:00
yamt 592c954dc7 don't merge incompatible map entries. eg. private and shared. 2005-01-01 21:11:51 +00:00
yamt a880e5e2b5 in the case of !PMAP_MAP_POOLPAGE, gather pool backend allocations to
large chunks for kernel_map and kmem_map to ease kva fragmentation.
2005-01-01 21:08:02 +00:00
yamt 95c82bfee4 introduce vm_map_kernel, a subclass of vm_map, and
move some kernel-only members of vm_map to it.
2005-01-01 21:02:12 +00:00
yamt 1207308b90 for in-kernel maps,
- allocate kva for vm_map_entry from the map itsself and
  remove the static limit, MAX_KMAPENT.
- keep merged entries for later splitting to fix allocate-to-free problem.
  PR/24039.
2005-01-01 21:00:06 +00:00
yamt c4d95d51f4 uvm_fault: pass NULL pap to pmap_extract where we don't need paddr. 2005-01-01 09:14:49 +00:00
briggs ddcb68edd6 mlock(2) and munlock(2) are defined by our man pages (which agree with
those on opengroup.org) to return ENOMEM if trying to lock a region that
is not accessible.  So if uvm_map_pageable() returns EFAULT, make it ENOMEM.
2004-12-02 15:23:47 +00:00
yamt 90f65b5587 UVMHIST_LOG: avoid division. 2004-11-23 05:08:33 +00:00
yamt 040648dfd0 constify. 2004-11-23 04:57:17 +00:00
yamt f25d78c712 introduce UVMHIST_LOANHIST and sprinkle UVMHIST_LOGs. 2004-11-23 04:51:56 +00:00
yamt aec42f41c5 - prevent wired pages from being loaned, rather than just panicking.
caller should take care of failure by eg. falling back to dumb copy.
  PR/23285.
- add some related assertions.
2004-11-21 06:45:49 +00:00
yamt 05f25dcc2a move buffer queue related stuffs from buf.h to their own header, bufq.h. 2004-10-28 07:07:35 +00:00
yamt 62905a1302 uvm_pageidlezero: grab kernel_lock before uvm.fpageqlock. PR/27259. 2004-10-23 21:29:27 +00:00
yamt 56a653490c expose vm_page_zero_enable as vm.idlezero sysctl.
XXX assuming boolean_t == int.
2004-10-10 09:57:31 +00:00
yamt ffaa06d53c g/c stale declarations of page queues. 2004-10-07 10:56:26 +00:00
enami 682c3c9443 - Don't let pagedaemon sleep while draining buf.
- Estimate amount of memory to free at a time.
Address PR#27057 (and similar hangs I saw several months ago).
2004-10-03 08:47:48 +00:00
enami a55995c148 Count obj pages freed by pagedaemon. 2004-10-03 07:59:02 +00:00
yamt 49fe2034a3 uvm_map_printit:
- print wired_count if available.
- fix a printf format.
2004-09-25 04:19:38 +00:00
yamt 9555030270 make free page queue filo rather than fifo.
data in pages freed more recently are more likely on cpu cache.
2004-09-17 20:46:03 +00:00
yamt 175e99933e uvm_pagefree: when orphaning an A->K loaned page,
- decrement uvmexp.anonpages as it's no longer an anon page.
	- null out anon->u.an_page as the anon no longer own the page.
uvm_anfree: add related assertions.
2004-09-01 11:53:38 +00:00
yamt 23c60dbfe0 uvm_anfree: remove a comment which is no longer true. 2004-09-01 10:09:26 +00:00
thorpej 6c08646cb8 Garbage-collect pagemove(); nothing use it anymore (YAY!!!) 2004-08-28 22:12:40 +00:00
jdolecek 0139d61d6f uvm_grow(): avoid needless arithmetic and make LP64 safe 2004-08-28 12:44:22 +00:00
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat db2f5beb7d Sysctl descriptions under vm subtree 2004-05-25 04:31:17 +00:00
he df7ebfa9c3 Move variable declaration up before the code. Fixes compile error
for vax, and also conforms better to KNF.
2004-05-19 22:02:05 +00:00
darrenr e6416b1b3c rather than just try to get a mapping from a device as only PROT_EXEC, work
down the list of protections until either we run out or we find one that the
device is willing to work with.
2004-05-19 13:20:27 +00:00
christos 6d5a568271 don't accept a negative number of swap devices; it will attempt to malloc
something very large and might crash the kernel; From Evgeny Demidov
2004-05-14 16:56:09 +00:00
yamt 5469c2b7c1 add assertions. 2004-05-12 20:09:50 +00:00
yamt 1b03fa5302 uvm_page_unbusy: add assertions and comments about PG_RELEASED anon pages. 2004-05-05 11:58:27 +00:00
yamt 8368dac6a2 fix a amap_wirerange deadlock problem by re-introducing
PG_RELEASED for anon pages.  PR/23171 from Christian Limpach.
for details, see discussion filed in the PR database.

uvm_anon_release: a new function to free anon-owned PG_RELEASED page.
uvm_anfree: we can't wait for the page here because the caller might hold
	amap lock.  instead, just mark the page as PG_RELEASED.
	who unbusy the page should check the PG_RELEASED.
uvm_aio_aiodone: uvm_anon_release() instead of uvm_page_unbusy()
	if appropriate.
uvmfault_anonget: check PG_RELEASED.
2004-05-05 11:54:32 +00:00
yamt bd712164d0 ubc_release: grab uobj's vmobjlock when calling uvm_page_unbusy(). 2004-05-05 11:35:40 +00:00
pk 2fb3dac280 Since a `vmspace' always includes a `vm_map' we can re-use vm_map's
reference count lock to also protect the vmspace's reference count.
2004-05-04 21:33:40 +00:00
petrov 1ac4411c10 Revert default uvm counters, rename UVMMAP_COUNTERS to UVMMAP_NOCOUNTERS. 2004-05-03 20:10:35 +00:00
pk 9b96c17df2 Make uvm_uarea_free an inline function. 2004-05-02 13:04:57 +00:00
petrov 5f4709f782 Replace uvm counters with evcnt, initialize them through __link_set (from Matt Thomas),
disable counters by default and add configuration option UVMMAP_COUNTERS.
2004-05-01 19:40:39 +00:00
enami 4b8bc2b80f Make strlen calls to be folded to constant at compile time. 2004-04-29 23:13:35 +00:00
junyoung 9262158d3e Fix typo in comments. 2004-04-27 09:50:43 +00:00
junyoung f539f210cc FINDSPACE_FIXED -> UVM_FLAG_FIXED in comment. 2004-04-27 09:45:02 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
simonb 04680727b1 s/this this/this/. 2004-04-23 02:48:12 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
simonb 19f85c9cf1 Fix a tyop. 2004-04-05 01:39:07 +00:00
pk daff668b49 Use maxdmap and maxsmap instead of MAXDSIZ and MAXSSIZ. 2004-04-04 18:21:48 +00:00
yamt dabac1bc03 uvm_map_findspace: don't return unaligned address if alignment is specified.
discussed on tech-kern@.
2004-03-30 12:59:09 +00:00
he 8721979173 Conditionalize a few more declarations, as they may be defined as macros:
pmap_collect, pmap_reference, and pmap_remove (observed lossage for vax).
2004-03-27 00:59:55 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
junyoung 325f5482a8 Nuke __P(). 2004-03-24 07:55:01 +00:00
junyoung 1e2b269ded - Nuke __P().
- Drop trailing spaces.
2004-03-24 07:50:48 +00:00
junyoung 7e0c058612 Drop trailing spaces. 2004-03-24 07:47:32 +00:00
junyoung ff32ba0bff pmap_copy() and pmap_update() might be defined as macros in <machine/pmap.h>. 2004-03-23 14:15:59 +00:00
mycroft 2fef5d8dfc Something I posted to tech-kern a long time ago...
Slightly simplify uvm_map_extract() slightly by eliminating "oldstart".
2004-03-17 23:58:12 +00:00
jdolecek 43bafa5c97 fix typo in comment 2004-03-14 16:47:23 +00:00
pooka c5e500a486 Reflect dropping mappings in map_size.
Avoids panic on DIAGNOSTIC kernels.

ok by chs
2004-03-11 15:03:47 +00:00
dbj 5dc123ec73 add debugging assertion ensuring UBC_FAULTBUSY is only used with UBC_WRITE 2004-03-05 20:44:01 +00:00
yamt 9359a18b6a uvm_fault: check loan_count of neighborhood object page properly.
PR/24595 from Stephan Uphoff.
2004-03-02 11:43:44 +00:00
dsl bcaf57b039 Fix prev. so it compiles 2004-02-14 16:40:22 +00:00
jdolecek af46922ada add compat hook in check for zerodev; use this hook to recognize
the old ARM /dev/zero minor mapping #ifdef COMPAT_16
fixes second part of PR kern/23581 by Richard Earnshaw
2004-02-14 12:20:14 +00:00
drochner 41b5db514b make this compile whether DIAGNOSTIC is defined or not 2004-02-13 17:17:04 +00:00
yamt 546aea4d9c when breaking a loan from uobj,
insert the replacement page into the same position
as the original page on the object memq so that
genfs_putpages (and lfs) won't be confused.

noted by Stephan Uphoff (PR/24328)
2004-02-13 13:47:16 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
yamt babebaa9f9 uvm_loanentry: add a missing uvmfault_unlockall. 2004-02-13 11:15:30 +00:00
matt a78a1b0777 Back out the changes in
http://mail-index.netbsd.org/source-changes/2004/01/29/0027.html
since they don't really fix the problem.

Incorpate one fix:  Mark uvm_map_entry's that were created with
UVM_FLAG_NOMERGE so that they will not be used as future merge
candidates.
2004-02-10 01:30:49 +00:00
dbj c32c758d2d s/fauling/faulting/ 2004-02-10 00:40:06 +00:00
yamt 1e18e59746 - borrow vmspace0 in uvm_proc_exit instead of uvmspace_free.
the latter is not a appropriate place to do so and it broke vfork.
- deactivate pmap before calling cpu_exit() to keep a balance of
  pmap_activate/deactivate.
2004-02-09 13:11:21 +00:00
yamt 8fb96e0be4 introduce a new patchable variable, uvm_debug_check_rbtree,
which is zero by default.
perform rbtree sanity checks only when it isn't zero
because the check is very heavy weight especially when
there're many entries.
2004-02-07 13:22:19 +00:00
yamt a45adbd9c7 don't deactivate pmap in exit1 because we'll touch the pmap later.
instead, borrow vmspace0 immediately before destroying the pmap
in uvmspace_free.
2004-02-07 10:05:52 +00:00
yamt 4124096ea8 uvm_kmapent_alloc:
in the case that there's no cached entries,
if kmem_map is already up, allocate a entry from it
so that we won't try to vm_map_lock recursively.
XXX assuming usage pattern of kmem_map.
2004-02-07 08:02:21 +00:00
he be19fc25f3 Since the playstation2 port still uses a variant of gcc 2.95.2,
change to use a zero-sized array instead of c99 flexible array
member in a struct.

OK'ed by yamt.
2004-02-02 23:13:44 +00:00
yamt 6f979c2127 uvm_loanuobjpages: fix a comment. 2004-01-30 12:01:27 +00:00
yamt c5ffc97d8e remove wrong assertions.
sparc's alloc_cpuinfo_global_va() partially unmaps kva range in kernel_map.

noted by Juergen Hannken-Illjes on current-users@.
2004-01-30 11:56:39 +00:00
tls aeaf748ff2 Buffer cache fixes to avoid thrashing between high and low water marks
and uncontrolled growth.

The key fix is from Dan Carasone, who noticed that buf_canfree() was
counting in _bytes_ but freeing in _buffers_, which caused the instant
drop to lowater observed by some users.

We now control the rate of growth; the probability of getting a new
allocation is inversely proportional to the current size of the
cache.  This idea is from a long-ago conversation with Kirk McKusick
and, if memory serves, was used for the file-system cache in some
other BSD variant at some point in history.

With growth and shrinkage more or less dealt with, we return the
default maximum cache size to 15%.  The default _minimum_ cache size
is raised from 1/16 of the maximum cache size to 1/8, since 1/16 was
chosen when the maximum size was 30% of memory.

Finally, after observing the behaviour of the pagedaemon and the
buffer cache drainer under pathological workloads (e.g. a benchmark
that steps through 75% of available memory backwards) I have moved
the call to buf_drain() to the beginning of the pagedaemon from the
end; if the pagedaemon bogs down, it still won't get run as often
as it should, but at least this way it will see the state of the
free count and free target _before_ the scan step does its thing.
2004-01-30 11:32:16 +00:00
yamt d6e6e2e5c8 some English fixes from Soren Jacobsen. 2004-01-29 12:07:29 +00:00
yamt 20c5bc5099 - split uvm_map() into two functions for the followings.
- for in-kernel maps, disable map entry merging so that
  unmap operations won't block. (workaround for PR/24039)
- for in-kernel maps, allocate kva for vm_map_entry from
  the map itsself and eliminate MAX_KMAPENT and
  uvm_map_entry_kmem_pool.
2004-01-29 12:06:02 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
dbj 5b4c9f2016 rearrange struct uvm_history to put the struct simplelock at the end.
This avoids problems with the kernel grovelling vmstat -u/-U when
using LOCKDEBUG, which changes the size of struct simplelock.
Replaced the original location of the simplelock with "int unused"
so that binary compatibility will be retained with old vmstat.
2004-01-24 21:29:03 +00:00