Commit Graph

472 Commits

Author SHA1 Message Date
John Dyson
819c1c6f43 Missing (prototype) change from the previous commit. 1996-07-27 03:47:35 +00:00
John Dyson
4f4d35edf0 This commit is meant to solve a couple of VM system problems or
performance issues.

	1) The pmap module has had too many inlines, and so the
	   object file is simply bigger than it needs to be.
	   Some common code is also merged into subroutines.
	2) Removal of some *evil* PHYS_TO_VM_PAGE macro calls.
	   Unfortunately, a few have needed to be added also.
	   The removal caused the need for more vm_page_lookups.
	   I added lookup hints to minimize the need for the
	   page table lookup operations.
	3) Removal of some bogus performance improvements, that
	   mostly made the code more complex (tracking individual
	   page table page updates unnecessarily).  Those improvements
	   actually hurt 386 processors perf (not that people who
	   worry about perf use 386 processors anymore :-)).
	4) Changed pv queue manipulations/structures to be TAILQ's.
	5) The pv queue code has had some performance problems since
	   day one.  Some significant scalability issues are resolved
	   by threading the pv entries from the pmap AND the physical
	   address instead of just the physical address.  This makes
	   certain pmap operations run much faster.  This does
	   not affect most micro-benchmarks, but should help loaded system
	   performance *significantly*.  DG helped and came up with most
	   of the solution for this one.
	6) Most if not all pmap bit operations follow the pattern:
		pmap_test_bit();
		pmap_clear_bit();
	   That made for twice the necessary pv list traversal.   The
	   pmap interface now supports only pmap_tc_bit type operations:
	   pmap_[test/clear]_modified, pmap_[test/clear]_referenced.
	   Additionally, the modified routine now takes a vm_page_t arg
	   instead of a phys address.  This eliminates a PHYS_TO_VM_PAGE
	   operation.
	7) Several rewrites of routines that contain redundant code to
	   use common routines, so that there is a greater likelihood of
	   keeping the cache footprint smaller.
1996-07-27 03:24:10 +00:00
Bruce Evans
6ab46d52a5 Don't use NULL in non-pointer contexts. 1996-07-12 04:12:25 +00:00
John Dyson
502ba6e4a8 Back-off on the previous commit, specifically remove the look-ahead
optimization on the active queue scan.  I will do this correctly later.
1996-07-08 03:22:55 +00:00
John Dyson
c8c4b40cca Fix a problem with the pageout daemon RSS limiting, where it degrades
performance to LRU or worse when RSS limiting takes effect.  Also,
make an end condition in the active queue scan more efficient in the
case where pages are removed from the active queue as a side effect
of a pmap operation.
1996-07-08 02:25:53 +00:00
David Greenman
9579ee641a In all special cases for spl or page_alloc where kmem_map is check for,
mb_map (a submap of kmem_map) must also be checked.
Thanks to wcarchive (err...sort of) for demonstrating this bug.
1996-07-07 03:27:41 +00:00
John Dyson
a6e6bcc5f4 Properly set the PG_MAPPED and PG_WRITEABLE flags. This fixes some potential
problems with vm_map_remove/vm_map_delete.
1996-07-02 02:08:02 +00:00
John Dyson
877329e059 Make -current consistant with -stable regarding time that a process
sleeps before being swapped out.  The time is increased from 4 secs to
10 secs.  Originally I had decreased it from 20 to 4, but that is a bit
severe.  20 is too long though.
1996-06-30 21:16:18 +00:00
David Greenman
01155bd720 Make sure we have an object in the map entry before trying to trim pages
from it.
1996-06-29 09:17:17 +00:00
John Dyson
38efa82b23 This commit does a couple of things:
Re-enables the RSS limiting, and the routine is now tail-recursive,
	making it much more safe (eliminates the possiblity of kernel stack
	overflow.) Also, the RSS limiting is a little more intelligent about
	finding the likely objects that are pushing the process over the limit.

	Added some sysctls that help with VM system tuning.

New sysctl features:
	1)	Enable/disable lru pageout algorithm.
		vm.pageout_algorithm = 0, default algorithm that works
			well, especially using X windows and heavy
			memory loading.  Can have adverse effects,
			sometimes slowing down program loading.

		vm.pageout_algorithm = 1, close to true LRU.  Works much
			better than clock, etc.  Does not work as well as
			the default algorithm in general.  Certain memory
			"malloc" type benchmarks work a little better with
			this setting.

		Please give me feedback on the performance results
		associated with these.

	2)	Enable/disable swapping.
		vm.swapping_enabled = 1, default.

		vm.swapping_enabled = 0, useful for cases where swapping
			degrades performance.

		The config option "NO_SWAPPING" is still operative, and
		takes precedence over the sysctl.  If "NO_SWAPPING" is
		specified, the sysctl still exists, but "vm.swapping_enabled"
		is hard-wired to "0".

Each of these can be changed "on the fly."
1996-06-26 05:39:27 +00:00
John Dyson
f0e2953e5e Fix some serious problems with limits checking in the sbrk(2)/brk(2)
code.
Reviewed by:	bde
1996-06-25 00:36:46 +00:00
John Dyson
a001376dc3 Remove RSS limiting until I rewrite the code to be non-recursive. The
code can overrun the kernel stack under very stressful conditions.
1996-06-24 04:30:24 +00:00
John Dyson
2a4eb04bfd Improve algorithm for page hash queue. It was previously about
as bad as it could be.  This algorithm appears to improve fork
performance (barely) measurably.
1996-06-21 05:39:22 +00:00
John Dyson
ef743ce6ed Several bugfixes/improvements:
1) Make it much less likely to miss a wakeup in vm_page_free_wakeup
	2) Create a new entry point into pmap: pmap_ts_referenced, eliminates
	   the need to scan the pv lists twice in many cases.  Perhaps there
	   is alot more to do here to work on minimizing pv list manipulation
	3) Minor improvements to vm_pageout including the use of pmap_ts_ref.
	4) Major changes and code improvement to pmap.  This code has had
	   several serious bugs in page table page manipulation.  In order
	   to simplify the problem, and hopefully solve it for once and all,
	   page table pages are no longer "managed" with the pv list stuff.
	   Page table pages are only (mapped and held/wired) or
	   (free and unused) now.  Page table pages are never inactive,
	   active or cached.  These changes have probably fixed the
	   hold count problems, but if they haven't, then the code is
	   simpler anyway for future bugfixing.
	5) The pmap code has been sorely in need of re-organization, and I
	   have taken a first (of probably many) steps.  Please tell me
	   if you have any ideas.
1996-06-17 03:35:40 +00:00
John Dyson
b5b40fa62b Various bugfixes/cleanups from me and others:
1) Remove potential race conditions on waking up in vm_page_free_wakeup
   by making sure that it is at splvm().
2) Fix another bug in vm_map_simplify_entry.
3) Be more complete about converting from default to swap pager
   when an object grows to be large enough that there can be
   a problem with data structure allocation under low memory
   conditions.
4) Make some madvise code more efficient.
5) Added some comments.
1996-06-16 20:37:31 +00:00
David Greenman
664275648a Move a case of PG_MAPPED being set before a pmap_enter(). This will likely
make no difference, but it will make it consistent with other uses of
PG_MAPPED.
1996-06-14 23:26:40 +00:00
John Dyson
419702a468 Fix a very significant cnt.v_wire_count leak in vm_page.c, and some
minor leaks in pmap.c.  Bruce Evans made me aware of this problem.
1996-06-12 06:52:12 +00:00
John Dyson
5fcf66debe Fix some serious errors in vm_map_simplify_entries. 1996-06-12 04:03:21 +00:00
John Dyson
3091ee0955 Mostly superficial code improvements, add a diagnostic. The
code improvements include significant simplification of the reservation
of the swap pager control blocks for reads.  Add a panic for an inconsistent
swap pager control block count.
1996-06-10 04:58:48 +00:00
John Dyson
c82b01813e Keep the vm_fault/vm_pageout from getting into an "infinite paging loop", by
reserving "cached" pages before waking up the pageout daemon.  This will reserve
the faulted page, and keep the system from thrashing itself to death given
this condition.
1996-06-10 00:25:40 +00:00
John Dyson
886d3e1150 Adjust the threshold for blocking on movement of pages from the cache
queue in vm_fault.

Move the PG_BUSY in vm_fault to the correct place.

Remove redundant/unnecessary code in pmap.c.

Properly block on rundown of page table pages, if they are busy.

I think that the VM system is in pretty good shape now, and the following
individuals (among others, in no particular order) have helped with this
recent bunch of bugs, thanks!  If I left anyone out, I apologize!

Stephen McKay, Stephen Hocking, Eric J. Chet, Dan O'Brien, James Raynard,
Marc Fournier.
1996-06-08 06:48:35 +00:00
John Dyson
6b6f000870 Keep page-table pages from ever being sensed as dirty. This should fix
some problems with the page-table page management code, since it can't
deal with the notion of page-table pages being paged out or in transit.
Also, clean up some stylistic issues per some suggestions from
Stephen McKay.
1996-06-05 03:31:49 +00:00
John Dyson
ff97964a2e Disable madvise optimizations for device pager objects (some of the
operations don't work with FICTITIOUS pages.)  Also, close a window
between PG_MANAGED and pmap_enter that can mess up the accounting of
the managed flag.  This problem could likely cause a hold_count error
for page table pages.
1996-06-01 20:50:57 +00:00
John Dyson
f35329ac0f This commit is dual-purpose, to fix more of the pageout daemon
queue corruption problems, and to apply Gary Palmer's code cleanups.
David Greenman helped with these problems also.  There is still
a hang problem using X in small memory machines.
1996-05-31 00:38:04 +00:00
John Dyson
545901f794 Correct some unfortunately chosen constants, otherwise, not enough
pages are calculated for deferred allocation of swap pager data structures.
This is a follow-on to the previous commit to this file.
1996-05-29 06:33:30 +00:00
John Dyson
b182ec9eb4 After careful review by David Greenman and myself, David had found a
case where blocking can occur, thereby giving other process's a chance
to modify the queue where a page resides.  This could cause numerous
process and system failures.
1996-05-29 05:15:33 +00:00
John Dyson
a5b6fd29a3 Make sure that pageout deadlocks cannot occur. There is a problem
that the datastructures needed to support the swap pager can take
enough space to fully deplete system memory, and cause a deadlock.
This change keeps large objects from being filled with dirty pages
without the appropriate swap pager datastructures.  Right now,
default objects greater than 1/4 the size of available system memory
are converted to swap objects, thereby eliminating the risk of deadlock.
1996-05-29 05:12:23 +00:00
John Dyson
85a376eb93 Fix a couple of problems in the pageout_scan routine. First, there is
a condition when blocking can occur, and the daemon did not check properly
for a page remaining on the expected queue.  Additionally, the inactive
target was being set much too large for small memory machines.  It is now
being calculated based upon the amount of user memory available on every
pageout daemon run.  Another problem was that if memory was very low, the
pageout daemon could fail repeatedly to traverse the inactive queue.
1996-05-26 07:52:09 +00:00
John Dyson
0ed4376231 I think this covers (fixes) the last batch of freeing active/held/busy page
problem.  BY MISTAKE, the vm_page_unqueue (or equiv) was removed from the
vm_fault code.  Really bad things appear to happen if a page is on a queue
while it is being faulted.
1996-05-26 05:30:33 +00:00
John Dyson
f777ab7b8b Add an assert to vm_page_cache. We should never cache a dirty page. 1996-05-24 05:20:15 +00:00
John Dyson
1eeaa1e31f Add apparently needed splvm protection to the active queue, and eliminate
an unnecessary test for dirty pages if it is already known to be dirty.
1996-05-24 05:19:15 +00:00
John Dyson
3077a9c2f4 Eliminate inefficient check for dirty pages for pages in the PQ_CACHE
queue.  Also, modify the MADV_FREE policy (it probably still isn't the final
version.)
1996-05-24 05:17:21 +00:00
John Dyson
a9d4727439 Make the conversion from the default pager to swap pager more robust
in the face of low memory conditions.
1996-05-24 05:14:44 +00:00
John Dyson
99ea1af0a6 Eliminate a vm_page_free, busy panic, in kern_malloc. 1996-05-23 02:24:55 +00:00
John Dyson
0a47b48b9f Initial support for MADV_FREE, support for pages that we don't care
about the contents anymore.  This gives us alot of the advantage of
freeing individual pages through munmap, but with almost none of the
overhead.
1996-05-23 00:45:58 +00:00
John Dyson
4a62209c07 After reviewing the previous commit to vm_object, the page protection
is never necessary, not just for PG_FICTICIOUS.
1996-05-21 17:13:31 +00:00
John Dyson
07c647c528 Don't protect non-managed pages off during object rundown. This fixes
a hang that occurs under certain circumstances when exiting X.
1996-05-21 05:26:27 +00:00
John Dyson
867a482d66 Initial support for mincore and madvise. Both are almost fully
supported, except madvise does not page in with MADV_WILLNEED, and
MADV_DONTNEED doesn't force dirty pages out.
1996-05-19 07:36:50 +00:00
John Dyson
7f5fe93fc7 One more file missing from the mega-commit. This inlines some very
simple routines in vm_page.c, so that an unnecessary subroutine call
is removed.
1996-05-18 04:00:18 +00:00
John Dyson
1b4435b8ce File mistakenly left out of the previous mega-commit. This provides
a global defn for 'exech_map.'
1996-05-18 03:52:13 +00:00
John Dyson
b18bfc3da7 This set of commits to the VM system does the following, and contain
contributions or ideas from Stephen McKay <syssgm@devetir.qld.gov.au>,
Alan Cox <alc@cs.rice.edu>, David Greenman <davidg@freebsd.org> and me:

	More usage of the TAILQ macros.  Additional minor fix to queue.h.
	Performance enhancements to the pageout daemon.
		Addition of a wait in the case that the pageout daemon
		has to run immediately.
		Slightly modify the pageout algorithm.
	Significant revamp of the pmap/fork code:
		1) PTE's and UPAGES's are NO LONGER in the process's map.
		2) PTE's and UPAGES's reside in their own objects.
		3) TOTAL elimination of recursive page table pagefaults.
		4) The page directory now resides in the PTE object.
		5) Implemented pmap_copy, thereby speeding up fork time.
		6) Changed the pv entries so that the head is a pointer
		   and not an entire entry.
		7) Significant cleanup of pmap_protect, and pmap_remove.
		8) Removed significant amounts of machine dependent
		   fork code from vm_glue.  Pushed much of that code into
		   the machine dependent pmap module.
		9) Support more completely the reuse of already zeroed
		   pages (Page table pages and page directories) as being
		   already zeroed.
	Performance and code cleanups in vm_map:
		1) Improved and simplified allocation of map entries.
		2) Improved vm_map_copy code.
		3) Corrected some minor problems in the simplify code.
	Implemented splvm (combo of splbio and splimp.)  The VM code now
		seldom uses splhigh.
	Improved the speed of and simplified kmem_malloc.
	Minor mod to vm_fault to avoid using pre-zeroed pages in the case
		of objects with backing objects along with the already
		existant condition of having a vnode.  (If there is a backing
		object, there will likely be a COW...  With a COW, it isn't
		necessary to start with a pre-zeroed page.)
	Minor reorg of source to perhaps improve locality of ref.
1996-05-18 03:38:05 +00:00
Garrett Wollman
cb7545a995 Allocate mbufs from a separate submap so that NMBCLUSTERS works as
expected.
1996-05-10 19:28:55 +00:00
Poul-Henning Kamp
aa8de40ae5 Another sweep over the pmap/vm macros, this time with more focus on
the usage.  I'm not satisfied with the naming, but now at least there is
less bogus stuff around.
1996-05-03 21:01:54 +00:00
Poul-Henning Kamp
e911eafcba removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
        ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
        NPDEPG

Major macro cleanup.
1996-05-02 14:21:14 +00:00
Poul-Henning Kamp
a8c5fef5e6 KGDB is dead. It may come back one day if somebody does it. 1996-05-02 09:34:51 +00:00
John Dyson
3ea2f344e0 Move the map entry allocations from the kmem_map to the kernel_map. As
a side effect, correct the associated object offset.
1996-04-29 22:04:57 +00:00
John Dyson
0891ef4c9a This fixes kmem_malloc/kmem_free (and malloc/free of objects of > 8K).
A page index was calculated incorrectly in vm_kern, and vm_object_page_remove
removed pages that should not have been.
1996-04-24 04:16:45 +00:00
Bruce Evans
bd105bb750 Fixed a spl hog. The vmdaemon process ran entirely at splhigh. It
sometimes disabled clock interrupts for 60 msec or more on a P133.
Clock interrupts were lost ...

Reviewed by:	dyson
1996-04-11 21:05:25 +00:00
John Dyson
d3a3498598 Reinstitute the map lock for processes being swapped out. This
is needed because of the vm_fault used to bring the page table page
for the kernel stack (UPAGES) back in.  The consequence of the
previous incorrect change was a system hang.
1996-04-09 04:36:58 +00:00
John Dyson
b5cfb15fad Map lock checks not needed anymore for swapping out. We don't use
map operations for it anymore.  Certain deadlocks should never happen
anymore.
1996-04-08 03:42:01 +00:00
Bruce Evans
6ffde942bf Removed never-used #includes of <machine/cpu.h>. Many were apparently
copied from bad examples.
1996-04-07 17:39:28 +00:00
John Dyson
030ad08012 Fixed a problem that the UPAGES of a process were being run down
in a suboptimal manner.  I had also noticed some panics that appeared
to be at least superficially caused by this problem.  Also, included
are some minor mods to support more general handling of page table page
faulting.  More details in a future commit.
1996-04-03 05:23:44 +00:00
David Greenman
46268a606f Revert to previous calculation of vm_object_cache_max: it simply works
better in most real-world cases.
1996-03-29 06:28:48 +00:00
Bruce Evans
8375baabed Undid last revision. It duplicated part of second last revision. 1996-03-28 15:40:17 +00:00
Marc G. Fournier
7f49be143c devfs_add_devsw() -> devfs_add_devswf modifications
Reviewed by:	julian@freebsd.org
1996-03-28 14:36:48 +00:00
John Dyson
bb35ebd6cc Add a function prototype for pmap_prefault. 1996-03-28 04:54:50 +00:00
John Dyson
30dcfc09f2 VM performance improvements, and reorder some operations in VM fault
in anticipation of a fix in pmap that will allow the mlock system call to work
without panicing the system.
1996-03-28 04:53:28 +00:00
John Dyson
f32dbbeeed More map_simplify fixes from Alan Cox. This very significanly improves the
performance when the map has been chopped up.  The map simplify operations
really work now.
Reviewed by: dyson
Submitted by:	Alan Cox <alc@cs.rice.edu>
1996-03-28 04:22:17 +00:00
Bruce Evans
5ea390eff5 Added drum device.
Submitted by:	partly by "Marc G. Fournier" <scrappy@ki.net>
1996-03-27 20:09:26 +00:00
John Dyson
ad5dd2341c Fix the problem that unmounting filesystems that are backed by a VMIO
device have reference count problems.  We mark the underlying object
ono-persistent, and account for the reference count that the VM system
maintainsfor the special device close.  This should fix the removable
device problem.
1996-03-19 05:13:22 +00:00
David Greenman
8f2ec877b8 Force device mappings to always be shared. It doesn't make sense for them
to ever be COW and we need the mappings to be shared for backward
compatibilty.

Reviewed by:	dyson
1996-03-16 15:00:05 +00:00
John Dyson
308c24ba5e This commit is as a result of a comment by Alan Cox (alc@cs.rice.edu)
regarding the "real" problem with maps that we have been having
over the last few weeks.  He noted that the first_free pointer was
left dangling in certain circumstances -- and he was right!!!   This
should fix the map problems that we were having, and also give us the
advantage of being able to simplify maps more aggressively.
1996-03-13 01:18:14 +00:00
John Dyson
2fc2c638d5 Fix the map corruption problem that appears as a u_map allocation
error.
1996-03-12 13:46:13 +00:00
John Dyson
5850152d95 Allow mmap'ed devices to work correctly across forks. The sanest
solution appeared to be to allow the child to maintain the same mapping as
the parent.
1996-03-12 02:27:20 +00:00
Jeffrey Hsu
1b67ec6de9 For Lite2: proc LIST changes.
Reviewed by:	 davidg & bde
1996-03-11 06:11:43 +00:00
John Dyson
9ea857084d Delay forking a process until there are more pages available. It was
possible to deadlock with the low threshold that we had used.
1996-03-09 06:57:53 +00:00
John Dyson
9ee58740bc Modify a threshold for waking up the pageout daemon. Also, add a consistancy
check for making sure that held pages aren't freed (DG).
1996-03-09 06:56:39 +00:00
John Dyson
c68f9c929b Add a missing initialization of the hold_count for device pager ficticiouse
pages.
1996-03-09 06:54:41 +00:00
John Dyson
6ac5bfdb3a Fix a calculation for a paging parameter. 1996-03-09 06:53:27 +00:00
John Dyson
67cc64f4c7 Fix two problems:
The pmap_remove in vm_map_clean incorrectly unmapped the entire
	map entry.
	The new vm_map_simplify_entry code had an error (the offset
	of the combined map entry was not set correctly.)
Submitted by:	Alan Cox <alc@cs.rice.edu>
1996-03-09 06:52:05 +00:00
John Dyson
65bc79b85f Set the page valid bits in fewer places, as opposed to being scattered
in various places.
1996-03-09 06:48:26 +00:00
John Dyson
45952afcc7 Fix a problem in the swap pager that caused some of the pages that
were paged in under low swap space conditions to both loose their
backing store and their dirty bits.  This would cause pages to
be demand zeroed under certain conditions in low VM space conditions
and consequential sig-11's or sig-10's.  This situation was made
worse lately when the level for swap space reclaim threshold was
increased.
1996-03-06 04:31:46 +00:00
John Dyson
8a02c104f9 Fix a problem that pages in a mapped region were not always
properly invalidated.  Now we traverse the object shadow chain
properly.
1996-03-04 02:04:24 +00:00
John Dyson
836e5d1360 In order to fix some concurrency problems with the swap pager early
on in the FreeBSD development, I had made a global lock around the
rlist code.  This was bogus, and now the lock is maintained on a
per resource list basis.  This now allows the rlist code to be used for
almost any non-interrupt level application.
1996-03-03 21:11:08 +00:00
Peter Wemm
5e004bea6f Remove the #ifdef notyet from the prototype of vm_map_simplify. John
re-enabled the function but missed the prototype, causing a warning.
1996-03-03 18:53:10 +00:00
Peter Wemm
9154ee6aec Oops.. I nearly forgot the actual core of the length/rounding/etc fixes
that Bruce asked for.

These still are not quite perfect, and in particular, it can get
upset on extreme boundary cases (addr = 0xfff, len = 0xffffffff,
which would end up mapping a single page rather than failing), but
this is better code that I committed before.

(note, the VM system does not (apparently) support single mmap segment
sizes above 0x80000000 anyway)
1996-03-02 17:14:09 +00:00
John Dyson
de5f6a7765 1) Eliminate unnecessary bzero of UPAGES.
2) Eliminate unnecessary copying of pages during/after forks.
3) Add user map simplification.
1996-03-02 02:54:24 +00:00
Peter Wemm
dabee6fecc kern_descrip.c: add fdshare()/fdcopy()
kern_fork.c: add the tiny bit of code for rfork operation.
kern/sysv_*: shmfork() takes one less arg, it was never used.
sys/shm.h: drop "isvfork" arg from shmfork() prototype
sys/param.h: declare rfork args.. (this is where OpenBSD put it..)
sys/filedesc.h: protos for fdshare/fdcopy.
vm/vm_mmap.c: add minherit code, add rounding to mmap() type args where
it makes sense.
vm/*: drop unused isvfork arg.

Note: this rfork() implementation copies the address space mappings,
it does not connect the mappings together.  ie: once the two processes
have split, the pages may be shared, but the address space is not. If one
does a mmap() etc, it does not appear in the other.  This makes it not
useful for pthreads, but it is useful in it's own right for having
light-weight threads in a static shared address space.

Obtained from: Original by Ron Minnich, extended by OpenBSD
1996-02-23 18:49:25 +00:00
David Greenman
5afce28270 Add a "NO_SWAPPING" option to disable swapping. This was originally done
to help diagnose a problem on wcarchive (where the kernel stack was
sometimes not present), but is useful in its own right since swapping
actually reduces performance on some systems (such as wcarchive).
Note: swapping in this context means making the U pages pageable and has
nothing to do with generic VM paging, which is unaffected by this option.

Reviewed by:	 <dyson>
1996-02-22 10:57:37 +00:00
John Dyson
a02051c37a Fixed a really bogus problem with msync ripping pages away from
objects before they were written.  Also, don't allow processes
without write access to remove pages from vm_objects.
1996-02-11 22:03:49 +00:00
John Dyson
dca5129987 Changed vm_fault_quick in vm_machdep.c to be global. Needed for
new pipe code.
1996-02-04 22:09:12 +00:00
David Greenman
1af87c9263 "out of space" -> "out of swap space". 1996-01-31 13:14:21 +00:00
David Greenman
729b1e5149 Improved killproc() log message and made it and the other similar message
tolerant of p_ucred being invalid. Starting using killproc() where
appropriate.
1996-01-31 12:44:33 +00:00
David Greenman
8c73da1e15 Print a more descriptive message when the mb_map is filled (out of mbuf
clusters), and tell the operator what to do about it (increase maxusers).
1996-01-31 12:05:52 +00:00
Mike Pritchard
6c5e9bbdf5 Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.
1996-01-30 23:02:38 +00:00
David Greenman
2c68345ab4 Added a check/panic for vm_map_find failing to find space for the page
tables/u-pages when forking. This is a "can't happen" case. :-)
1996-01-29 12:10:30 +00:00
Bruce Evans
324e9ed2a4 Added a `boundary' arg to vm_alloc_page_contig(). Previously the only
way to avoid crossing a 64K DMA boundary was to specify an alignment
greater than the size even when the alignment didn't matter, and for
sizes larger than a page, this reduced the chance of finding enough
contiguous pages.  E.g., allocations of 8K not crossing a 64K boundary
previously had to be allocated on 8K boundaries; now they can be
allocated on any 4K boundary except (64 * n + 60)K.

Fixed bugs in vm_alloc_page_contig():
- the last page wasn't allocated for sizes smaller than a page.
- failures of kmem_alloc_pageable() weren't handled.

Mutated vm_page_alloc_contig() to create a more convenient interface
named contigmalloc().  This is the same as the one in 1.1.5 except
it has `low' and `high' args, and the `alignment' and `boundary'
args are multipliers instead of masks.
1996-01-27 00:13:33 +00:00
Poul-Henning Kamp
f782b11a04 Don't use %r, we havn't got it anymore.
Submitted by: bde
1996-01-25 07:15:40 +00:00
John Dyson
bd7e5f992e Eliminated many redundant vm_map_lookup operations for vm_mmap.
Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish
	overhead for merged cache.
Efficiency improvement for vfs_cluster.  It used to do alot of redundant
	calls to cluster_rbuild.
Correct the ordering for vrele of .text and release of credentials.
Use the selective tlb update for 486/586/P6.
Numerous fixes to the size of objects allocated for files.  Additionally,
	fixes in the various pagers.
Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs.
Fixes in the swap pager for exhausted resources.  The pageout code
	will not as readily thrash.
Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into
	page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE),
	thereby improving efficiency of several routines.
Eliminate even more unnecessary vm_page_protect operations.
Significantly speed up process forks.
Make vm_object_page_clean more efficient, thereby eliminating the pause
	that happens every 30seconds.
Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the
	case of filesystems mounted async.
Fix a panic with busy pages when write clustering is done for non-VMIO
	buffers.
1996-01-19 04:00:31 +00:00
Garrett Wollman
0e41ee3037 Convert DDB to new-style option. 1996-01-04 21:13:23 +00:00
Garrett Wollman
50c73f3620 Convert SYSV IPC to new-style options. (I hope I got everything...)
The LKMs will need an extra file, to come later.
1996-01-04 20:29:06 +00:00
David Greenman
a2d5b14236 Increased vm_object_cache_max by about 50% to yield better utilization of
memory when lots of small files are cached.

Reviewed by:	dyson
1996-01-04 18:32:31 +00:00
Peter Wemm
a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Julian Elischer
1dfcbb0ce3 i386/i386/conf.c is no longer needed.. remove it from files.i386
redistribute a few last routines to beter places and shoot the file

I haven't act actually 'deleted' the file yet togive people time
to
have done a config.. I.e. they are likely to have done one in a week or so
so I'll remove it then..
 it's now empty.
makes the question of a USL copyright rather moot.
1995-12-21 20:09:46 +00:00
John Dyson
d63596ce9e Fix paging from ext2fs (and other fs w/block size < PAGE_SIZE). This
should fix kern/900.
1995-12-17 23:29:56 +00:00
Bruce Evans
927c0b1131 Cleaned up prototypes in pmap headers: removed ones for nonexistent
functions; moved misplaced ones; restored most of KNFish formatting
from 4.4lite version; removed bogus __BEGIN/END_DECLS.
1995-12-17 07:39:05 +00:00
Bruce Evans
f2c6b65bab Fixed 1TB filesize changes. Some pindexes had bogus names and types
but worked because vm_pindex_t is indistinuishable from vm_offset_t.
1995-12-17 07:19:58 +00:00
Poul-Henning Kamp
f708ef1b9e Another mega commit to staticize things. 1995-12-14 09:55:16 +00:00
Poul-Henning Kamp
87b6de2b76 A Major staticize sweep. Generates a couple of warnings that I'll deal
with later.
A number of unused vars removed.
A number of unused procs removed or #ifdefed.
1995-12-14 08:32:45 +00:00
Julian Elischer
6ba9ebce28 devsw tables are now arrays of POINTERS to struct [cb]devsw
seems to work hre just fine though  I can't check every file
that changed due to limmited h/w, however I've checked enught to be petty
happy withe hte code..

WARNING... struct lkm[mumble] has changed
so it might be an idea to recompile any lkm related programs
1995-12-13 15:13:57 +00:00
John Dyson
3048c51216 There was a bug that the size for an msync'ed region was not rounded
up.  The effect of this was that msync with a size would generally sync
1 page less than it should.  This problem was brought to my attention
by Darrel Herbst <dherbst@gradin.cis.upenn.edu> and Ron Minnich
<rminnich@sarnoff.com>.
1995-12-13 12:28:39 +00:00
John Dyson
cb6962cdee Some new anti-deadlock code ended up messing up the paging stats. A modified
version of the code is now in place, and gausspage performance is back
up to where it should be.
1995-12-11 15:43:33 +00:00
John Dyson
ec07c60c6a Some DIAGNOSTIC code was enabled all of the time in error. The
diagnostic code is now conditional on #ifdef DIAGNOSTIC again.
1995-12-11 15:41:50 +00:00
John Dyson
a316d390bd Changes to support 1Tb filesizes. Pages are now named by an
(object,index) pair instead of (object,offset) pair.
1995-12-11 04:58:34 +00:00
Bruce Evans
4439655d52 Replaced nxdump by nodump (if the dump function gets called, then the
device must be configured, so ENXIO is a bogus errno).

Replaced zerosize by nopsize.  zerosize was a temporary alias.
1995-12-10 19:53:42 +00:00
Bruce Evans
9b4288a3d5 Restored used includes of <vm/vm_extern.h>. 1995-12-10 14:52:10 +00:00
Bruce Evans
5ad9d5a70f Moved the declaration of boolean_t from <vm/vm_param.h> to
<sys/types.h> (if KERNEL is defined).  This allows removing bogus
dependencies on vm stuff in several places (e.g., ddb) and stops
<vm_param.h> from depending on <vm_param.h>

Added declaration of boolean_t to <vm/vm.h> (if KERNEL is not
defined).  It never belonged in <vm/vm_param.h>.  Unfortunately,
it is required for some vm headers that are included by applications.

Deleted declarations of TRUE and FALSE from <vm/vm_param.h>.  They
are defined in <sys/param.h> if KERNEL is defined and we'll soon
find out if any applications depend on them being defined in a vm
header.
1995-12-10 02:34:29 +00:00
Poul-Henning Kamp
d2f265fab8 Julian forgot to make the *devsw structures static. 1995-12-08 23:23:00 +00:00
Julian Elischer
87f6c6625d Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
1995-12-08 11:19:42 +00:00
David Greenman
efeaf95a41 Untangled the vm.h include file spaghetti. 1995-12-07 12:48:31 +00:00
Bruce Evans
0ff89d5b03 Moved the declaration of vm_object_t from <vm/vm.h> to <sys/types.h>
(if KERNEL is defined).  This allows removing the #includes of vm
stuff in vnode_if.h, which will speed up the compilation of LINT by
about 5%.
1995-12-05 20:54:42 +00:00
Poul-Henning Kamp
946bb7a268 A major sweep over the sysctl stuff.
Move a lot of variables home to their own code (In good time before xmas :-)

Introduce the string descrition of format.

Add a couple more functions to poke into these marvels, while I try to
decide what the correct interface should look like.

Next is adding vars on the fly, and sysctl looking at them too.

Removed a tine bit of defunct and #ifdefed notused code in swapgeneric.
1995-12-04 16:48:58 +00:00
Bruce Evans
f31d402c5a Fixed the type mismatch in check for the bogus mmap function `nullop'.
The test should never succeed and should go away.  Temporarily print
a warning if it does succeed.
1995-12-03 18:59:55 +00:00
Bruce Evans
cac597e4c0 Completed function declarations and/or added prototypes.
Staticized some functions.

__purified some functions.  Some functions were bogusly declared as
returning `const'.  This hasn't done anything since gcc-2.5.  For
later versions of gcc, the equivalent is __attribute__((const)) at
the end of function declarations.
1995-12-03 12:18:39 +00:00
Bruce Evans
d841aaa740 Finished (?) cleaning up sysinit stuff. 1995-12-02 17:11:20 +00:00
Julian Elischer
7198bf4725 If you're going to mechanically replicate something in 50 files
it's best to not have a (compiles cleanly) typo in it! (sigh)
1995-11-29 14:41:20 +00:00
Julian Elischer
53ac6efbd8 OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c..
my next trick will be to define cdevsw[] and bdevsw[]
as empty arrays and remove all those DAMNED defines as well..

Each of these drivers has a SYSINIT linker set entry
that comes in very early.. and asks teh driver to add it's own
entry to the two devsw[] tables.

some slight reworking of the commits from yesterday (added the SYSINIT
stuff and some usually wrong but token DEVFS entries to all these
devices.

BTW does anyone know where the 'ata' entries in conf.c actually reside?
seems we don't actually have a 'ataopen() etc...

If you want to add a new device in conf.c
please  make sure I know
so I can keep it up to date too..

as before, this is all dependent on #if defined(JREMOD)
(and #ifdef DEVFS in parts)
1995-11-29 10:49:16 +00:00
Bruce Evans
512fef80a9 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
Poul-Henning Kamp
3af768903d Remove unused vars & funcs, make things static, protoize a little bit. 1995-11-20 12:20:02 +00:00
Bruce Evans
ff98689d2d Fixed recent staticizations. Some protypes for static functions were
left in headers and not staticized.
1995-11-16 09:51:22 +00:00
Poul-Henning Kamp
f5a1271110 staticize. 1995-11-14 20:53:20 +00:00
Poul-Henning Kamp
a9ad941c7a Move all the VM sysctl stuff home where it belongs. 1995-11-14 09:29:34 +00:00
David Greenman
f81b859263 Fixed up a comment and removed some #if 0'd code. 1995-11-13 10:53:38 +00:00
David Greenman
bea41bcf3a Moved vm_map_lock call to inside the splhigh protection in vm_map_find().
This closes a probably rare but nonetheless real window that would result
in a process hanging or the system panicing.

Reviewed by:	dyson, davidg
Submitted by:	kato@eclogite.eps.nagoya-u.ac.jp (KATO Takenori)
1995-11-12 08:58:58 +00:00
Bruce Evans
d2d3e8751c Included <sys/sysproto.h> to get central declarations for syscall args
structs and prototypes for syscalls.

Ifdefed duplicated decentralized declarations of args structs.  It's
convenient to have this visible but they are hard to maintain.  Some
are already different from the central declarations.  4.4lite2 puts
them in comments in the function headers but I wanted to avoid the
large changes for that.
1995-11-12 06:43:28 +00:00
Bruce Evans
9ed1bde79c Fixed type of obreak(). The args struct member name conflicted with
the (better) machine generated one in <sys/sysproto.h>.
1995-11-11 06:40:35 +00:00
David Greenman
42e9339d38 Initialize lock struct entries explicitly rather than calling bzero(). 1995-11-06 08:44:15 +00:00
Bruce Evans
8b25681eb5 Replaced bogus macros for dummy devswitch entries by functions.
These functions went away:

	enosys (hasn't been used for some time)
	enxio
	enodev
	enoioctl (was used only once, actually for a vop)

if_tun.c:
Continued cleaning up...

conf.h:
Probably fixed the type of d_reset_t.  It is hard to tell the correct
type because there are no non-dummy device reset functions.

Removed last vestige of ambiguous sleep message strings.
1995-11-06 00:36:19 +00:00
John Dyson
aef922f514 Greatly simplify the msync code. Eliminate complications in vm_pageout
for msyncing.  Remove a bug that manifests itself primarily on NFS
(the dirty range on the buffers is not set on msync.)
1995-11-05 20:46:03 +00:00
David Greenman
23922ccaca Move page fixups (pmap_clear_modify, etc) that happen after paging input
completes out of vm_fault and into the pagers. This get rid of some
redundancy and improves the architecture.

Reviewed by:	John Dyson <dyson>
1995-11-02 06:42:47 +00:00
Bruce Evans
0b8253a746 Don't pass an extra trailing arg to some functions.
Added the prototypes that found this bug.
1995-10-30 17:56:30 +00:00
John Dyson
a91c5a7ecd Get rid of machine-dependent NBPG and replace with PAGE_SIZE. 1995-10-23 05:35:48 +00:00
John Dyson
d559b36913 Remove of now unused PG_COPYONWRITE. 1995-10-23 04:29:39 +00:00
John Dyson
e17bed1226 First phase of removing the PG_COPYONWRITE flag, and an architectural
cleanup of mapping files.
1995-10-23 03:49:43 +00:00
John Dyson
2c4488fce3 Finalize GETPAGES layering scheme. Move the device GETPAGES
interface into specfs code.  No need at this point to modify the
PUTPAGES stuff except in the layered-type (NULL/UNION) filesystems.
1995-10-23 02:23:29 +00:00
John Dyson
02c04a2f6c Implement mincore system call. 1995-10-21 17:42:28 +00:00
David Greenman
eed2d59b25 Fix initialization of "bsize" in vnode_pager_haspage(). It must happen
after the check for the mount point still existing or else the system
will panic if someone forcibly unmounted the filesystem.
1995-10-19 21:35:03 +00:00
John Dyson
0bc3a91127 Remove an unnecessary tsleep in the swapin code. This tsleep
can defer swapping in processes and is just not the right thing to do.
1995-10-16 05:45:49 +00:00
David Greenman
cd41fc123e Fix argument passing to the "freeer" routine. Added some prototypes. (bde)
Moved extern declaration of swap_pager_full into swap_pager.h and out of
the various files that reference it. (davidg)

Submitted by:	bde & davidg
1995-10-07 19:02:56 +00:00
Poul-Henning Kamp
a5eb0e27e4 Avoid a 64bit divide. 1995-10-06 09:42:11 +00:00
Bruce Evans
f2caf6f548 Fix pollution of application namespace by declarations of kernel
functions.  The application header <sys/user.h> includes <vm/vm.h>
which includes <vm/lock.h>...

vm.h:
Don't include <machine/cpufunc.h>.  It is already included by
<sys/systm.h> in the kernel and isn't designed to be included by
applications (the 2.1 version causes a syntax error in C++ and the
current version has initializers that are invalid in strict C++).

lock.h:
Only declare kernel functions if KERNEL is defined.
1995-10-05 01:11:48 +00:00
John Dyson
0e27a03ffb Perform more checking for proper loading of the UPAGES when a process
is swapped in.  Also, remove unnecessary map locking/unlocking during
selection of processes to be swapped out.

This code might afford proper panics as opposed to spontaneous reboots
on certain systems.  This should allow us to debug these problems better.
1995-09-24 19:51:50 +00:00
John Dyson
22ba64e870 Significantly simplify the fault clustering code. After some analysis by
David Greenman, it has been determined that the more sophisticated code
only made a very minor difference in fault performance.  Therefore, this
code eliminates some of the complication of the fault code, decreasing
the amount of CPU used to scan shadow chains.
1995-09-24 19:47:58 +00:00
David Greenman
2f82e60467 Check that the swap block is valid before including it in a cluster.
Submitted by:	John Dyson
1995-09-24 04:40:19 +00:00
David Greenman
c87ad37e61 Check the return value from vm_map_pageable() when mapping the process's
UPAGES and associated page table page. Panic on error. This is less than
optimial and will be fixed in the future, but is better than the old
behavior of panicing with a "kernel page directory invalid" in pmap_enter.
1995-09-17 01:46:03 +00:00
John Dyson
21bf390418 Fixed a typo in vm_fault_additional_pages. 1995-09-14 13:42:52 +00:00
John Dyson
6eab77f210 Fix really bogus casting of a block number to a long. Also change the
comparison from a "< 0" to "== -1" like it should be.
1995-09-12 14:42:43 +00:00
John Dyson
894048d71c Make sure that the prezero flag is cleared when needed. 1995-09-11 00:47:17 +00:00
John Dyson
b1fc01b7da Fix an error that can cause attempted reading beyond the end of file. 1995-09-11 00:46:19 +00:00
John Dyson
ccbb2f7226 Code cleanup and minor performance improvement in the faultin cluster
code.
1995-09-11 00:45:15 +00:00