Skip site navigation (1)Skip section navigation (2)

CVS log for src/sys/vm/vm_fault.c

[BACK] Up to [FreeBSD] / src / sys / vm

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.293.2.2.2.1: download - view: text, markup, annotated - select for diffs
Fri Nov 11 04:20:22 2011 UTC (2 months, 4 weeks ago) by kensmith
Branches: RELENG_9_0
CVS tags: RELENG_9_0_0_RELEASE
Diff to: previous 1.293.2.2: preferred, colored; next MAIN 1.294: preferred, colored
Changes since revision 1.293.2.2: +0 -0 lines
SVN rev 227445 on 2011-11-11 04:20:22Z by kensmith

Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
cycle.

Approved by:	re (implicit)

Revision 1.293.2.2: download - view: text, markup, annotated - select for diffs
Wed Oct 12 20:08:25 2011 UTC (3 months, 4 weeks ago) by kib
Branches: RELENG_9
CVS tags: RELENG_9_0_BP
Branch point for: RELENG_9_0
Diff to: previous 1.293.2.1: preferred, colored; branchpoint 1.293: preferred, colored; next MAIN 1.294: preferred, colored
Changes since revision 1.293.2.1: +2 -10 lines
SVN rev 226319 on 2011-10-12 20:08:25Z by kib

Handle page dirty mask with atomics.

MFC r225838:
Use the explicitly-sized types for the dirty and valid masks.

MFC r225840:
Use the trick of performing the atomic operation on the contained aligned
word to handle the dirty mask updates in vm_page_clear_dirty_mask().

MFC 225841
Remove locking of the vm page queues from several pmaps.

MFC r225843:
Fix grammar.

MFC r225856:
Style nit.

Approved by:	re (bz)

Revision 1.294: download - view: text, markup, annotated - select for diffs
Wed Sep 28 14:57:50 2011 UTC (4 months, 1 week ago) by kib
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.293: preferred, colored
Changes since revision 1.293: +2 -10 lines
SVN rev 225840 on 2011-09-28 14:57:50Z by kib

Use the trick of performing the atomic operation on the contained aligned
word to handle the dirty mask updates in vm_page_clear_dirty_mask().
Remove the vm page queue lock around vm_page_dirty() call in vm_fault_hold()
the sole purpose of which was to protect dirty on architectures which
does not provide short or byte-wide atomics.

Reviewed by:	alc, attilio
Tested by:	flo (sparc64)
MFC after:	2 weeks

Revision 1.293.2.1: download - view: text, markup, annotated - select for diffs
Fri Sep 23 00:51:37 2011 UTC (4 months, 2 weeks ago) by kensmith
Branches: RELENG_9
Diff to: previous 1.293: preferred, colored
Changes since revision 1.293: +0 -0 lines
SVN rev 225736 on 2011-09-23 00:51:37Z by kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by:	re (implicit)

Revision 1.293: download - view: text, markup, annotated - select for diffs
Tue Sep 6 10:30:11 2011 UTC (5 months ago) by kib
Branches: MAIN
CVS tags: RELENG_9_BP
Branch point for: RELENG_9
Diff to: previous 1.292: preferred, colored
Changes since revision 1.292: +1 -3 lines
SVN rev 225418 on 2011-09-06 10:30:11Z by kib

Split the vm_page flags PG_WRITEABLE and PG_REFERENCED into atomic
flags field. Updates to the atomic flags are performed using the atomic
ops on the containing word, do not require any vm lock to be held, and
are non-blocking. The vm_page_aflag_set(9) and vm_page_aflag_clear(9)
functions are provided to modify afalgs.

Document the changes to flags field to only require the page lock.

Introduce vm_page_reference(9) function to provide a stable KPI and
KBI for filesystems like tmpfs and zfs which need to mark a page as
referenced.

Reviewed by:    alc, attilio
Tested by:      marius, flo (sparc64); andreast (powerpc, powerpc64)
Approved by:	re (bz)

Revision 1.292: download - view: text, markup, annotated - select for diffs
Sat Jul 9 15:21:10 2011 UTC (7 months ago) by kib
Branches: MAIN
Diff to: previous 1.291: preferred, colored
Changes since revision 1.291: +16 -0 lines
SVN rev 223889 on 2011-07-09 15:21:10Z by kib

Add a facility to disable processing page faults. When activated,
uiomove generates EFAULT if any accessed address is not mapped, as
opposed to handling the fault.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	alc (previous version)

Revision 1.291: download - view: text, markup, annotated - select for diffs
Thu Jun 23 05:23:59 2011 UTC (7 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.290: preferred, colored
Changes since revision 1.290: +1 -2 lines
SVN rev 223464 on 2011-06-23 05:23:59Z by alc

Revert to using the page queues lock in vm_page_clear_dirty_mask() on
MIPS.  (At present, although atomic_clear_char() is defined by atomic.h
on MIPS, it is not actually implemented by support.S.)

Revision 1.290: download - view: text, markup, annotated - select for diffs
Sun Jun 19 19:13:24 2011 UTC (7 months, 3 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.289: preferred, colored
Changes since revision 1.289: +10 -0 lines
SVN rev 223307 on 2011-06-19 19:13:24Z by alc

Precisely document the synchronization rules for the page's dirty field.
(Saying that the lock on the object that the page belongs to must be held
only represents one aspect of the rules.)

Eliminate the use of the page queues lock for atomically performing read-
modify-write operations on the dirty field when the underlying architecture
supports atomic operations on char and short types.

Document the fact that 32KB pages aren't really supported.

Reviewed by:	attilio, kib

Revision 1.289: download - view: text, markup, annotated - select for diffs
Fri Mar 25 16:38:10 2011 UTC (10 months, 2 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.288: preferred, colored
Changes since revision 1.288: +2 -0 lines
SVN rev 220001 on 2011-03-25 16:38:10Z by kib

Handle the corner case in vm_fault_quick_hold_pages().

If supplied length is zero, and user address is invalid, function
might return -1, due to the truncation and rounding of the address.
The callers interpret the situation as EFAULT. Instead of handling
the zero length in caller, filter it in vm_fault_quick_hold_pages().

Sponsored by:	The FreeBSD Foundation
Reviewed by:	alc

Revision 1.254.2.8: download - view: text, markup, annotated - select for diffs
Sat Feb 26 21:27:41 2011 UTC (11 months, 1 week ago) by alc
Branches: RELENG_8
Diff to: previous 1.254.2.7: preferred, colored; branchpoint 1.254: preferred, colored; next MAIN 1.255: preferred, colored
Changes since revision 1.254.2.7: +1 -4 lines
SVN rev 219066 on 2011-02-26 21:27:41Z by alc

MFC r217453
  For some time now, the kernel and kmem objects have been ordinary
  OBJT_PHYS objects.  Thus, there is no need for handling them specially
  in vm_fault().  In fact, this special case handling would have led to
  an assertion failure just before the call to pmap_enter().

Revision 1.288: download - view: text, markup, annotated - select for diffs
Sat Jan 15 19:21:28 2011 UTC (12 months, 3 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.287: preferred, colored
Changes since revision 1.287: +1 -4 lines
SVN rev 217453 on 2011-01-15 19:21:28Z by alc

For some time now, the kernel and kmem objects have been ordinary
OBJT_PHYS objects.  Thus, there is no need for handling them specially
in vm_fault().  In fact, this special case handling would have led to
an assertion failure just before the call to pmap_enter().

Reviewed by:	kib@
MFC after:	6 weeks

Revision 1.287: download - view: text, markup, annotated - select for diffs
Tue Dec 28 20:02:30 2010 UTC (13 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.286: preferred, colored
Changes since revision 1.286: +1 -1 lines
SVN rev 216772 on 2010-12-28 20:02:30Z by alc

Correct a typo in vm_fault_quick_hold_pages().

Reported by:	Bartosz Stec

Revision 1.286: download - view: text, markup, annotated - select for diffs
Sat Dec 25 23:54:50 2010 UTC (13 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.285: preferred, colored
Changes since revision 1.285: +0 -18 lines
SVN rev 216701 on 2010-12-25 23:54:50Z by alc

Retire vm_fault_quick().  It's no longer used.

Reviewed by:	kib@

Revision 1.285: download - view: text, markup, annotated - select for diffs
Sat Dec 25 21:26:56 2010 UTC (13 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.284: preferred, colored
Changes since revision 1.284: +75 -0 lines
SVN rev 216699 on 2010-12-25 21:26:56Z by alc

Introduce and use a new VM interface for temporarily pinning pages.  This
new interface replaces the combined use of vm_fault_quick() and
pmap_extract_and_hold() throughout the kernel.

In collaboration with:	kib@

Revision 1.237.2.4.2.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:10:29 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_7_4
CVS tags: RELENG_7_4_0_RELEASE
Diff to: previous 1.237.2.4: preferred, colored; next MAIN 1.237.6.1: preferred, colored
Changes since revision 1.237.2.4: +0 -0 lines
SVN rev 216618 on 2010-12-21 17:10:29Z by kensmith

Copy stable/7 to releng/7.4 in preparation for FreeBSD-7.4 release.

Approved by:	re (implicit)

Revision 1.254.2.7.2.1: download - view: text, markup, annotated - select for diffs
Tue Dec 21 17:09:25 2010 UTC (13 months, 2 weeks ago) by kensmith
Branches: RELENG_8_2
CVS tags: RELENG_8_2_0_RELEASE
Diff to: previous 1.254.2.7: preferred, colored; next MAIN 1.254.2.8: preferred, colored
Changes since revision 1.254.2.7: +0 -0 lines
SVN rev 216617 on 2010-12-21 17:09:25Z by kensmith

Copy stable/8 to releng/8.2 in preparation for FreeBSD-8.2 release.

Approved by:	re (implicit)

Revision 1.284: download - view: text, markup, annotated - select for diffs
Mon Dec 20 22:49:31 2010 UTC (13 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.283: preferred, colored
Changes since revision 1.283: +18 -5 lines
SVN rev 216604 on 2010-12-20 22:49:31Z by alc

Introduce vm_fault_hold() and use it to (1) eliminate a long-standing race
condition in proc_rwmem() and to (2) simplify the implementation of the
cxgb driver's vm_fault_hold_user_pages().  Specifically, in proc_rwmem()
the requested read or write could fail because the targeted page could be
reclaimed between the calls to vm_fault() and vm_page_hold().

In collaboration with:	kib@
MFC after:	6 weeks

Revision 1.283: download - view: text, markup, annotated - select for diffs
Thu Dec 2 17:37:16 2010 UTC (14 months, 1 week ago) by trasz
Branches: MAIN
Diff to: previous 1.282: preferred, colored
Changes since revision 1.282: +5 -5 lines
SVN rev 216128 on 2010-12-02 17:37:16Z by trasz

Replace pointer to "struct uidinfo" with pointer to "struct ucred"
in "struct vm_object".  This is required to make it possible to account
for per-jail swap usage.

Reviewed by:	kib@
Tested by:	pho@
Sponsored by:	FreeBSD Foundation

Revision 1.237.2.4: download - view: text, markup, annotated - select for diffs
Wed Nov 17 18:21:29 2010 UTC (14 months, 3 weeks ago) by alc
Branches: RELENG_7
CVS tags: RELENG_7_4_BP
Branch point for: RELENG_7_4
Diff to: previous 1.237.2.3: preferred, colored; branchpoint 1.237: preferred, colored; next MAIN 1.238: preferred, colored
Changes since revision 1.237.2.3: +12 -10 lines
SVN rev 215433 on 2010-11-17 18:21:29Z by alc

MFC r209407, r209648, r209650
  Introduce and use vm_page_next() and vm_page_prev().  They provide both
  a simpler and faster interface for iterating over the pages of an object.

Revision 1.254.2.7: download - view: text, markup, annotated - select for diffs
Wed Nov 17 17:29:22 2010 UTC (14 months, 3 weeks ago) by alc
Branches: RELENG_8
CVS tags: RELENG_8_2_BP
Branch point for: RELENG_8_2
Diff to: previous 1.254.2.6: preferred, colored; branchpoint 1.254: preferred, colored
Changes since revision 1.254.2.6: +12 -10 lines
SVN rev 215430 on 2010-11-17 17:29:22Z by alc

MFC r209407, r209648, r209650
  Introduce and use vm_page_next() and vm_page_prev().  They provide both
  a simpler and faster interface for iterating over the pages of an object.

Revision 1.282: download - view: text, markup, annotated - select for diffs
Fri Jul 2 19:59:18 2010 UTC (19 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.281: preferred, colored
Changes since revision 1.281: +12 -10 lines
SVN rev 209650 on 2010-07-02 19:59:18Z by alc

Use vm_page_prev() instead of vm_page_lookup() in the implementation of
vm_fault()'s automatic delete-behind heuristic.
vm_page_prev() is typically faster.

Revision 1.254.2.6: download - view: text, markup, annotated - select for diffs
Fri Jun 18 09:25:00 2010 UTC (19 months, 3 weeks ago) by kib
Branches: RELENG_8
Diff to: previous 1.254.2.5: preferred, colored; branchpoint 1.254: preferred, colored
Changes since revision 1.254.2.5: +6 -3 lines
SVN rev 209290 on 2010-06-18 09:25:00Z by kib

MFC r208340:
When waiting for the busy page, do not unlock the object unless unlock
cannot be avoided.

Revision 1.254.2.5.2.1: download - view: text, markup, annotated - select for diffs
Mon Jun 14 02:09:06 2010 UTC (19 months, 4 weeks ago) by kensmith
Branches: RELENG_8_1
CVS tags: RELENG_8_1_0_RELEASE
Diff to: previous 1.254.2.5: preferred, colored; next MAIN 1.254.2.6: preferred, colored
Changes since revision 1.254.2.5: +0 -0 lines
SVN rev 209145 on 2010-06-14 02:09:06Z by kensmith

Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.

Approved by:	re (implicit)

Revision 1.281: download - view: text, markup, annotated - select for diffs
Thu May 20 08:51:01 2010 UTC (20 months, 3 weeks ago) by kib
Branches: MAIN
Diff to: previous 1.280: preferred, colored
Changes since revision 1.280: +6 -3 lines
SVN rev 208340 on 2010-05-20 08:51:01Z by kib

When waiting for the busy page, do not unlock the object unless unlock
cannot be avoided.

Reviewed by:	alc
MFC after:	1 week

Revision 1.205.2.9: download - view: text, markup, annotated - select for diffs
Wed May 19 22:36:46 2010 UTC (20 months, 3 weeks ago) by attilio
Branches: RELENG_6
Diff to: previous 1.205.2.8: preferred, colored; branchpoint 1.205: preferred, colored; next MAIN 1.206: preferred, colored
Changes since revision 1.205.2.8: +15 -4 lines
SVN rev 208319 on 2010-05-19 22:36:46Z by attilio

MFC: r206264
When OOM searches for a process to kill, ignore the processes already
killed by OOM. When killed process waits for a page allocation, try to
satisfy the request as fast as possible.

Sponsored by:	Sandvine Incorporated

Revision 1.280: download - view: text, markup, annotated - select for diffs
Sun May 9 16:55:42 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.279: preferred, colored
Changes since revision 1.279: +0 -2 lines
SVN rev 207823 on 2010-05-09 16:55:42Z by alc

Push down the acquisition of the page queues lock into vm_pageq_remove().
(This eliminates a surprising number of page queues lock acquisitions by
vm_fault() because the page's queue is PQ_NONE and thus the page queues
lock is not needed to remove the page from a queue.)

Revision 1.279: download - view: text, markup, annotated - select for diffs
Sat May 8 21:35:51 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.278: preferred, colored
Changes since revision 1.278: +2 -1 lines
SVN rev 207798 on 2010-05-08 21:35:51Z by alc

Minimize the scope of the page queues lock in vm_fault().

Revision 1.278: download - view: text, markup, annotated - select for diffs
Sat May 8 20:34:01 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.277: preferred, colored
Changes since revision 1.277: +3 -12 lines
SVN rev 207796 on 2010-05-08 20:34:01Z by alc

Push down the page queues into vm_page_cache(), vm_page_try_to_cache(), and
vm_page_try_to_free().  Consequently, push down the page queues lock into
pmap_enter_quick(), pmap_page_wired_mapped(), pmap_remove_all(), and
pmap_remove_write().

Push down the page queues lock into Xen's pmap_page_is_mapped().  (I
overlooked the Xen pmap in r207702.)

Switch to a per-processor counter for the total number of pages cached.

Revision 1.277: download - view: text, markup, annotated - select for diffs
Fri May 7 15:49:43 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.276: preferred, colored
Changes since revision 1.276: +1 -6 lines
SVN rev 207746 on 2010-05-07 15:49:43Z by alc

Push down the page queues lock into vm_page_activate().

Revision 1.276: download - view: text, markup, annotated - select for diffs
Fri May 7 04:14:07 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.275: preferred, colored
Changes since revision 1.275: +0 -2 lines
SVN rev 207738 on 2010-05-07 04:14:07Z by alc

Push down the page queues lock into vm_page_deactivate().  Eliminate an
incorrect comment.

Revision 1.275: download - view: text, markup, annotated - select for diffs
Thu May 6 18:58:32 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.274: preferred, colored
Changes since revision 1.274: +1 -11 lines
SVN rev 207728 on 2010-05-06 18:58:32Z by alc

Eliminate page queues locking around most calls to vm_page_free().

Revision 1.274: download - view: text, markup, annotated - select for diffs
Wed May 5 18:16:06 2010 UTC (21 months ago) by alc
Branches: MAIN
Diff to: previous 1.273: preferred, colored
Changes since revision 1.273: +0 -2 lines
SVN rev 207669 on 2010-05-05 18:16:06Z by alc

Acquire the page lock around all remaining calls to vm_page_free() on
managed pages that didn't already have that lock held.  (Freeing an
unmanaged page, such as the various pmaps use, doesn't require the page
lock.)

This allows a change in vm_page_remove()'s locking requirements.  It now
expects the page lock to be held instead of the page queues lock.
Consequently, the page queues lock is no longer required at all by callers
to vm_page_rename().

Discussed with: kib

Revision 1.273: download - view: text, markup, annotated - select for diffs
Wed May 5 03:45:46 2010 UTC (21 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.272: preferred, colored
Changes since revision 1.272: +5 -9 lines
SVN rev 207644 on 2010-05-05 03:45:46Z by alc

Push down the acquisition of the page queues lock into vm_page_unwire().

Update the comment describing which lock should be held on entry to
vm_page_wire().

Reviewed by:	kib

Revision 1.272: download - view: text, markup, annotated - select for diffs
Tue May 4 15:55:41 2010 UTC (21 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.271: preferred, colored
Changes since revision 1.271: +0 -6 lines
SVN rev 207617 on 2010-05-04 15:55:41Z by alc

Add page locking to the vm_page_cow* functions.

Push down the acquisition and release of the page queues lock into
vm_page_wire().

Reviewed by:	kib

Revision 1.254.2.5: download - view: text, markup, annotated - select for diffs
Tue May 4 05:14:43 2010 UTC (21 months, 1 week ago) by kib
Branches: RELENG_8
CVS tags: RELENG_8_1_BP
Branch point for: RELENG_8_1
Diff to: previous 1.254.2.4: preferred, colored; branchpoint 1.254: preferred, colored
Changes since revision 1.254.2.4: +15 -6 lines
SVN rev 207596 on 2010-05-04 05:14:43Z by kib

MFC r206264:
When OOM searches for a process to kill, ignore the processes already
killed by OOM. When killed process waits for a page allocation, try to
satisfy the request as fast as possible.

Revision 1.271: download - view: text, markup, annotated - select for diffs
Sun May 2 20:24:25 2010 UTC (21 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.270: preferred, colored
Changes since revision 1.270: +5 -13 lines
SVN rev 207539 on 2010-05-02 20:24:25Z by alc

Simplify vm_fault().  The introduction of the new page lock renders a bit of
cleverness by vm_fault() to avoid repeatedly releasing and reacquiring the
page queues lock pointless.

Reviewed by:	kib, kmacy

Revision 1.270: download - view: text, markup, annotated - select for diffs
Sun May 2 17:33:46 2010 UTC (21 months, 1 week ago) by alc
Branches: MAIN
Diff to: previous 1.269: preferred, colored
Changes since revision 1.269: +6 -0 lines
SVN rev 207530 on 2010-05-02 17:33:46Z by alc

It makes no sense for vm_page_sleep_if_busy()'s helper, vm_page_sleep(),
to unconditionally set PG_REFERENCED on a page before sleeping.  In many
cases, it's perfectly ok for the page to disappear, i.e., be reclaimed by
the page daemon, before the caller to vm_page_sleep() is reawakened.
Instead, we now explicitly set PG_REFERENCED in those cases where having
the page persist until the caller is awakened is clearly desirable.  Note,
however, that setting PG_REFERENCED on the page is still only a hint,
and not a guarantee that the page should persist.

Revision 1.269: download - view: text, markup, annotated - select for diffs
Fri Apr 30 16:20:14 2010 UTC (21 months, 1 week ago) by kib
Branches: MAIN
Diff to: previous 1.268: preferred, colored
Changes since revision 1.268: +3 -3 lines
SVN rev 207438 on 2010-04-30 16:20:14Z by kib

Unlock page lock instead of recursively locking it.

Revision 1.268: download - view: text, markup, annotated - select for diffs
Fri Apr 30 00:46:43 2010 UTC (21 months, 1 week ago) by kmacy
Branches: MAIN
Diff to: previous 1.267: preferred, colored
Changes since revision 1.267: +58 -4 lines
SVN rev 207410 on 2010-04-30 00:46:43Z by kmacy

On Alan's advice, rather than do a wholesale conversion on a single
architecture from page queue lock to a hashed array of page locks
(based on a patch by Jeff Roberson), I've implemented page lock
support in the MI code and have only moved vm_page's hold_count
out from under page queue mutex to page lock. This changes
pmap_extract_and_hold on all pmaps.

Supported by: Bitgravity Inc.

Discussed with: alc, jeffr, and kib

Revision 1.267: download - view: text, markup, annotated - select for diffs
Wed Apr 28 06:34:47 2010 UTC (21 months, 2 weeks ago) by alc
Branches: MAIN
Diff to: previous 1.266: preferred, colored
Changes since revision 1.266: +0 -1 lines
SVN rev 207308 on 2010-04-28 06:34:47Z by alc

Setting PG_REFERENCED on a page at the end of vm_fault() is redundant since
the page table entry's accessed bit is either preset by the immediately
preceding call to pmap_enter() or by hardware (or software) upon return
from vm_fault() when the faulting access is restarted.

Revision 1.266: download - view: text, markup, annotated - select for diffs
Tue Apr 6 10:43:01 2010 UTC (22 months ago) by kib
Branches: MAIN
Diff to: previous 1.265: preferred, colored
Changes since revision 1.265: +15 -6 lines
SVN rev 206264 on 2010-04-06 10:43:01Z by kib

When OOM searches for a process to kill, ignore the processes already
killed by OOM. When killed process waits for a page allocation, try to
satisfy the request as fast as possible.

This removes the often encountered deadlock, where OOM continously
selects the same victim process, that sleeps uninterruptibly waiting
for a page. The killed process may still sleep if page cannot be
obtained immediately, but testing has shown that system has much
higher chance to survive in OOM situation with the patch.

In collaboration with:	pho
Reviewed by:	alc
MFC after:	4 weeks

Revision 1.237.2.3.2.1: download - view: text, markup, annotated - select for diffs
Wed Feb 10 00:26:20 2010 UTC (2 years ago) by kensmith
Branches: RELENG_7_3
CVS tags: RELENG_7_3_0_RELEASE
Diff to: previous 1.237.2.3: preferred, colored; next MAIN 1.237.2.4: preferred, colored
Changes since revision 1.237.2.3: +0 -0 lines
SVN rev 203736 on 2010-02-10 00:26:20Z by kensmith

Copy stable/7 to releng/7.3 as part of the 7.3-RELEASE process.

Approved by:	re (implicit)

Revision 1.265: download - view: text, markup, annotated - select for diffs
Sat Nov 28 00:50:09 2009 UTC (2 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.264: preferred, colored
Changes since revision 1.264: +2 -0 lines
SVN rev 199870 on 2009-11-28 00:50:09Z by alc

Properly synchronize the previous change.

Revision 1.264: download - view: text, markup, annotated - select for diffs
Fri Nov 27 22:08:29 2009 UTC (2 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.263: preferred, colored
Changes since revision 1.263: +6 -3 lines
SVN rev 199869 on 2009-11-27 22:08:29Z by alc

Support the new VM_PROT_COPY option on wired pages.  The effect of which
is that a debugger can now set a breakpoint in a program that uses mlock(2)
on its text segment or mlockall(2) on its entire address space.

Revision 1.263: download - view: text, markup, annotated - select for diffs
Fri Nov 27 20:24:11 2009 UTC (2 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.262: preferred, colored
Changes since revision 1.262: +11 -8 lines
SVN rev 199868 on 2009-11-27 20:24:11Z by alc

Simplify the invocation of vm_fault().  Specifically, eliminate the flag
VM_FAULT_DIRTY.  The information provided by this flag can be trivially
inferred by vm_fault().

Discussed with:	kib

Revision 1.262: download - view: text, markup, annotated - select for diffs
Thu Nov 26 05:16:07 2009 UTC (2 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.261: preferred, colored
Changes since revision 1.261: +1 -1 lines
SVN rev 199819 on 2009-11-26 05:16:07Z by alc

Replace VM_PROT_OVERRIDE_WRITE by VM_PROT_COPY.  VM_PROT_OVERRIDE_WRITE has
represented a write access that is allowed to override write protection.
Until now, VM_PROT_OVERRIDE_WRITE has been used to write breakpoints into
text pages.  Text pages are not just write protected but they are also
copy-on-write.  VM_PROT_OVERRIDE_WRITE overrides the write protection on the
text page and triggers the replication of the page so that the breakpoint
will be written to a private copy.  However, here is where things become
confused.  It is the debugger, not the process being debugged that requires
write access to the copied page.  Nonetheless, the copied page is being
mapped into the process with write access enabled.  In other words, once the
debugger sets a breakpoint within a text page, the program can write to its
private copy of that text page.  Whereas prior to setting the breakpoint, a
SIGSEGV would have occurred upon a write access.  VM_PROT_COPY addresses
this problem.  The combination of VM_PROT_READ and VM_PROT_COPY forces the
replication of a copy-on-write page even though the access is only for read.
Moreover, the replicated page is only mapped into the process with read
access, and not write access.

Reviewed by:	kib
MFC after:	4 weeks

Revision 1.261: download - view: text, markup, annotated - select for diffs
Wed Nov 18 18:05:54 2009 UTC (2 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.260: preferred, colored
Changes since revision 1.260: +13 -32 lines
SVN rev 199490 on 2009-11-18 18:05:54Z by alc

Simplify both the invocation and the implementation of vm_fault() for wiring
pages.

(Note: Claims made in the comments about the handling of breakpoints in
wired pages have been false for roughly a decade.  This and another bug
involving breakpoints will be fixed in coming changes.)

Reviewed by:	kib

Revision 1.254.2.4: download - view: text, markup, annotated - select for diffs
Tue Nov 17 18:38:00 2009 UTC (2 years, 2 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.254.2.3: preferred, colored; branchpoint 1.254: preferred, colored
Changes since revision 1.254.2.3: +46 -16 lines
SVN rev 199416 on 2009-11-17 18:38:00Z by kib

MFC r198505:
When protection of wired read-only mapping is changed to read-write,
install new shadow object behind the map entry and copy the pages
from the underlying objects to it. This makes the mprotect(2) call to
actually perform the requested operation instead of silently do nothing
and return success, that causes SIGSEGV on later write access to the
mapping.

Reuse vm_fault_copy_entry() to do the copying, modifying it to behave
correctly when src_entry == dst_entry.

Revision 1.254.2.3: download - view: text, markup, annotated - select for diffs
Tue Nov 17 18:31:09 2009 UTC (2 years, 2 months ago) by kib
Branches: RELENG_8
Diff to: previous 1.254.2.2: preferred, colored; branchpoint 1.254: preferred, colored
Changes since revision 1.254.2.2: +12 -13 lines
SVN rev 199415 on 2009-11-17 18:31:09Z by kib

MFC r198476 (by alc):
Simplify the inner loop of vm_fault_copy_entry().

Approved by:	alc

Revision 1.260: download - view: text, markup, annotated - select for diffs
Wed Nov 4 03:12:56 2009 UTC (2 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.259: preferred, colored
Changes since revision 1.259: +0 -1 lines
SVN rev 198870 on 2009-11-04 03:12:56Z by alc

Eliminate an unnecessary #include.  (This #include should have been removed
in r188331 when vnode_pager_lock() was eliminated.)

Revision 1.259: download - view: text, markup, annotated - select for diffs
Tue Nov 3 17:15:15 2009 UTC (2 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.258: preferred, colored
Changes since revision 1.258: +0 -11 lines
SVN rev 198855 on 2009-11-03 17:15:15Z by alc

Eliminate a bit of hackery from vm_fault().  The operations that this
hackery sought to prevent are now properly supported by vm_map_protect().
(See r198505.)

Reviewed by:	kib

Revision 1.237.2.3: download - view: text, markup, annotated - select for diffs
Sat Oct 31 18:46:55 2009 UTC (2 years, 3 months ago) by alc
Branches: RELENG_7
CVS tags: RELENG_7_3_BP
Branch point for: RELENG_7_3
Diff to: previous 1.237.2.2: preferred, colored; branchpoint 1.237: preferred, colored
Changes since revision 1.237.2.2: +2 -2 lines
SVN rev 198727 on 2009-10-31 18:46:55Z by alc

MFC r198472
  Eliminate an unnecessary check from vm_fault_prefault().

Revision 1.254.2.2: download - view: text, markup, annotated - select for diffs
Sat Oct 31 18:18:32 2009 UTC (2 years, 3 months ago) by alc
Branches: RELENG_8
Diff to: previous 1.254.2.1: preferred, colored; branchpoint 1.254: preferred, colored
Changes since revision 1.254.2.1: +2 -2 lines
SVN rev 198726 on 2009-10-31 18:18:32Z by alc

MFC r198472
  Eliminate an unnecessary check from vm_fault_prefault().

Revision 1.258: download - view: text, markup, annotated - select for diffs
Sat Oct 31 17:39:56 2009 UTC (2 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.257: preferred, colored
Changes since revision 1.257: +1 -1 lines
SVN rev 198721 on 2009-10-31 17:39:56Z by alc

Correct an error in vm_fault_copy_entry() that has existed since the first
version of this file.  When a process forks, any wired pages are immediately
copied because copy-on-write is not supported for wired pages.  In other
words, the child process is given its own private copy of each wired page
from its parent's address space.  Unfortunately, to date, these copied pages
have been mapped into the child's address space with the wrong permissions,
typically VM_PROT_ALL.  This change corrects the permissions.

Reviewed by:	kib

Revision 1.257: download - view: text, markup, annotated - select for diffs
Tue Oct 27 10:15:58 2009 UTC (2 years, 3 months ago) by kib
Branches: MAIN
Diff to: previous 1.256: preferred, colored
Changes since revision 1.256: +46 -16 lines
SVN rev 198505 on 2009-10-27 10:15:58Z by kib

When protection of wired read-only mapping is changed to read-write,
install new shadow object behind the map entry and copy the pages
from the underlying objects to it. This makes the mprotect(2) call to
actually perform the requested operation instead of silently do nothing
and return success, that causes SIGSEGV on later write access to the
mapping.

Reuse vm_fault_copy_entry() to do the copying, modifying it to behave
correctly when src_entry == dst_entry.

Reviewed by:	alc
MFC after:	3 weeks

Revision 1.256: download - view: text, markup, annotated - select for diffs
Mon Oct 26 00:01:52 2009 UTC (2 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.255: preferred, colored
Changes since revision 1.255: +12 -13 lines
SVN rev 198476 on 2009-10-26 00:01:52Z by alc

Simplify the inner loop of vm_fault_copy_entry().

Reviewed by:	kib

Revision 1.255: download - view: text, markup, annotated - select for diffs
Sun Oct 25 17:30:50 2009 UTC (2 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +2 -2 lines
SVN rev 198472 on 2009-10-25 17:30:50Z by alc

Eliminate an unnecessary check from vm_fault_prefault().

Revision 1.254.2.1.2.1: download - view: text, markup, annotated - select for diffs
Sun Oct 25 01:10:29 2009 UTC (2 years, 3 months ago) by kensmith
Branches: RELENG_8_0
CVS tags: RELENG_8_0_0_RELEASE
Diff to: previous 1.254.2.1: preferred, colored; next MAIN 1.254.2.2: preferred, colored
Changes since revision 1.254.2.1: +0 -0 lines
SVN rev 198460 on 2009-10-25 01:10:29Z by kensmith

Copy stable/8 to releng/8.0 as part of 8.0-RELEASE release procedure.

Approved by:	re (implicit)

Revision 1.237.2.2: download - view: text, markup, annotated - select for diffs
Mon Sep 14 17:34:49 2009 UTC (2 years, 4 months ago) by jhb
Branches: RELENG_7
Diff to: previous 1.237.2.1: preferred, colored; branchpoint 1.237: preferred, colored
Changes since revision 1.237.2.1: +2 -1 lines
SVN rev 197197 on 2009-09-14 17:34:49Z by jhb

MFC 195840, 195844, and 196637:
Add a new type of VM object: OBJT_SG.  An OBJT_SG object is very similar to
a device pager (OBJT_DEVICE) object in that it uses fictitious pages to
provide aliases to other memory addresses.  The primary difference is that
it uses an sglist(9) to determine the physical addresses for a given offset
into the object instead of invoking the d_mmap() method in a device driver.

Revision 1.254.2.1: download - view: text, markup, annotated - select for diffs
Mon Aug 3 08:13:06 2009 UTC (2 years, 6 months ago) by kensmith
Branches: RELENG_8
CVS tags: RELENG_8_0_BP
Branch point for: RELENG_8_0
Diff to: previous 1.254: preferred, colored
Changes since revision 1.254: +0 -0 lines
SVN rev 196045 on 2009-08-03 08:13:06Z by kensmith

Copy head to stable/8 as part of 8.0 Release cycle.

Approved by:	re (Implicit)

Revision 1.254: download - view: text, markup, annotated - select for diffs
Fri Jul 24 13:50:29 2009 UTC (2 years, 6 months ago) by jhb
Branches: MAIN
CVS tags: RELENG_8_BP
Branch point for: RELENG_8
Diff to: previous 1.253: preferred, colored
Changes since revision 1.253: +2 -1 lines
SVN rev 195840 on 2009-07-24 13:50:29Z by jhb

Add a new type of VM object: OBJT_SG.  An OBJT_SG object is very similar to
a device pager (OBJT_DEVICE) object in that it uses fictitious pages to
provide aliases to other memory addresses.  The primary difference is that
it uses an sglist(9) to determine the physical addresses for a given offset
into the object instead of invoking the d_mmap() method in a device driver.

Reviewed by:	alc
Approved by:	re (kensmith)
MFC after:	2 weeks

Revision 1.253: download - view: text, markup, annotated - select for diffs
Fri Jul 3 22:17:37 2009 UTC (2 years, 7 months ago) by kib
Branches: MAIN
Diff to: previous 1.252: preferred, colored
Changes since revision 1.252: +11 -10 lines
SVN rev 195329 on 2009-07-03 22:17:37Z by kib

When forking a vm space that has wired map entries, do not forget to
charge the objects created by vm_fault_copy_entry. The object charge
was set, but reserve not incremented.

Reported by:	Greg Rivers <gcr+freebsd-current tharned org>
Reviewed by:	alc (previous version)
Approved by:	re (kensmith)

Revision 1.252: download - view: text, markup, annotated - select for diffs
Thu Jun 25 20:33:45 2009 UTC (2 years, 7 months ago) by svn2cvs
Branches: MAIN
Diff to: previous 1.251: preferred, colored
Changes since revision 1.251: +5 -1 lines
manual sync of cvs tree due to export bug

Revision 1.251: download - view: text, markup, annotated - select for diffs
Sun Jun 7 19:38:26 2009 UTC (2 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.250: preferred, colored
Changes since revision 1.250: +3 -4 lines
SVN rev 193643 on 2009-06-07 19:38:26Z by alc

Eliminate unnecessary obfuscation when testing a page's valid bits.

Revision 1.250: download - view: text, markup, annotated - select for diffs
Thu May 7 05:44:13 2009 UTC (2 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.249: preferred, colored
Changes since revision 1.249: +0 -2 lines
SVN rev 191874 on 2009-05-07 05:44:13Z by alc

Eliminate an incorrect comment.

Revision 1.249: download - view: text, markup, annotated - select for diffs
Sun Apr 26 20:54:57 2009 UTC (2 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.248: preferred, colored
Changes since revision 1.248: +3 -5 lines
SVN rev 191531 on 2009-04-26 20:54:57Z by alc

Eliminate an archaic band-aid.  The immediately preceding comment already
explains why the band-aid is unnecessary.

Suggested by:	tegge

Revision 1.248: download - view: text, markup, annotated - select for diffs
Sun Apr 19 00:34:34 2009 UTC (2 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.247: preferred, colored
Changes since revision 1.247: +0 -1 lines
SVN rev 191256 on 2009-04-19 00:34:34Z by alc

Allow valid pages to be mapped for read access when they have a non-zero
busy count.  Only mappings that allow write access should be prevented by
a non-zero busy count.

(The prohibition on mapping pages for read access when they have a non-
zero busy count originated in revision 1.202 of i386/i386/pmap.c when
this code was a part of the pmap.)

Reviewed by:	tegge

Revision 1.237.2.1.2.1: download - view: text, markup, annotated - select for diffs
Wed Apr 15 03:14:26 2009 UTC (2 years, 9 months ago) by kensmith
Branches: RELENG_7_2
CVS tags: RELENG_7_2_0_RELEASE
Diff to: previous 1.237.2.1: preferred, colored; next MAIN 1.237.2.2: preferred, colored
Changes since revision 1.237.2.1: +0 -0 lines
SVN rev 191087 on 2009-04-15 03:14:26Z by kensmith

Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.

Approved by:	re (implicit)

Revision 1.237.2.1: download - view: text, markup, annotated - select for diffs
Thu Feb 26 15:59:22 2009 UTC (2 years, 11 months ago) by jhb
Branches: RELENG_7
CVS tags: RELENG_7_2_BP
Branch point for: RELENG_7_2
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +19 -5 lines
SVN rev 189075 on 2009-02-26 15:59:22Z by jhb

MFC: Add support for "superpages" on amd64 and i386.  This includes adding the
superpage reservation system to the machine-independent VM system as well as
changes to the pmap code for amd64 and i386 to support superpages.

Reviewed by:	alc
Tested by:	ps

Revision 1.247: download - view: text, markup, annotated - select for diffs
Wed Feb 25 07:52:53 2009 UTC (2 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.246: preferred, colored
Changes since revision 1.246: +7 -3 lines
SVN rev 189024 on 2009-02-25 07:52:53Z by alc

Prior to r188331 a map entry's last read offset was only updated by a hard
fault.  In r188331 this update was relocated because of synchronization
changes to a place where it would occur on both hard and soft faults.  This
change again restricts the update to hard faults.

Revision 1.246: download - view: text, markup, annotated - select for diffs
Mon Feb 9 06:23:21 2009 UTC (3 years ago) by alc
Branches: MAIN
Diff to: previous 1.245: preferred, colored
Changes since revision 1.245: +11 -5 lines
SVN rev 188383 on 2009-02-09 06:23:21Z by alc

Avoid some cases of unnecessary page queues locking by vm_fault's delete-
behind heuristic.

Revision 1.245: download - view: text, markup, annotated - select for diffs
Sun Feb 8 22:17:24 2009 UTC (3 years ago) by alc
Branches: MAIN
Diff to: previous 1.244: preferred, colored
Changes since revision 1.244: +0 -3 lines
SVN rev 188348 on 2009-02-08 22:17:24Z by alc

Eliminate OBJ_NEEDGIANT.  After r188331, OBJ_NEEDGIANT's only use is by a
redundant assertion in vm_fault().

Reviewed by:	kib

Revision 1.244: download - view: text, markup, annotated - select for diffs
Sun Feb 8 21:20:13 2009 UTC (3 years ago) by kib
Branches: MAIN
Diff to: previous 1.243: preferred, colored
Changes since revision 1.243: +0 -3 lines
SVN rev 188337 on 2009-02-08 21:20:13Z by kib

Remove no longer valid comment.

Submitted by:	alc

Revision 1.243: download - view: text, markup, annotated - select for diffs
Sun Feb 8 20:23:46 2009 UTC (3 years ago) by kib
Branches: MAIN
Diff to: previous 1.242: preferred, colored
Changes since revision 1.242: +80 -43 lines
SVN rev 188331 on 2009-02-08 20:23:46Z by kib

Do not sleep for vnode lock while holding map lock in vm_fault. Try to
acquire vnode lock for OBJT_VNODE object after map lock is dropped.
Because we have the busy page(s) in the object, sleeping there would
result in deadlock with vnode resize. Try to get lock without sleeping,
and, if the attempt failed, drop the state, lock the vnode, and restart
the fault handler from the start with already locked vnode.

Because the vnode_pager_lock() function is inlined in vm_fault(),
axe it.

Based on suggestion by:	alc
Reviewed by:	tegge, alc
Tested by:	pho

Revision 1.242: download - view: text, markup, annotated - select for diffs
Sun Feb 8 19:37:01 2009 UTC (3 years ago) by kib
Branches: MAIN
Diff to: previous 1.241: preferred, colored
Changes since revision 1.241: +2 -0 lines
SVN rev 188319 on 2009-02-08 19:37:01Z by kib

Style.

Revision 1.237.6.1: download - view: text, markup, annotated - select for diffs
Tue Nov 25 02:59:29 2008 UTC (3 years, 2 months ago) by kensmith
Branches: RELENG_7_1
CVS tags: RELENG_7_1_0_RELEASE
Diff to: previous 1.237: preferred, colored; next MAIN 1.238: preferred, colored
Changes since revision 1.237: +0 -0 lines
SVN rev 185281 on 2008-11-25 02:59:29Z by kensmith

Create releng/7.1 in preparation for moving into RC phase of 7.1 release
cycle.

Approved by:	re (implicit)

Revision 1.205.2.8.4.1: download - view: text, markup, annotated - select for diffs
Thu Oct 2 02:57:24 2008 UTC (3 years, 4 months ago) by kensmith
Branches: RELENG_6_4
CVS tags: RELENG_6_4_0_RELEASE
Diff to: previous 1.205.2.8: preferred, colored; next MAIN 1.205.2.9: preferred, colored
Changes since revision 1.205.2.8: +0 -0 lines
SVN rev 183531 on 2008-10-02 02:57:24Z by kensmith

Create releng/6.4 from stable/6 in preparation for 6.4-RC1.

Approved by:	re (implicit)

Revision 1.241: download - view: text, markup, annotated - select for diffs
Sun Mar 16 17:37:19 2008 UTC (3 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.240: preferred, colored
Changes since revision 1.240: +2 -2 lines
Simplify the inner loop of vm_fault()'s delete-behind heuristic.
Instead of checking each page for PG_UNMANAGED, perform a one-time
check whether the object is OBJT_PHYS.  (PG_UNMANAGED pages only
belong to OBJT_PHYS objects.)

Revision 1.240: download - view: text, markup, annotated - select for diffs
Sun Mar 9 06:08:58 2008 UTC (3 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.239: preferred, colored
Changes since revision 1.239: +1 -1 lines
Eliminate an unnecessary test from vm_fault's delete-behind heuristic.
Specifically, since the delete-behind heuristic is never applied to a
device-backed object, there is no point in checking whether each of the
object's pages is fictitious.  (Only device-backed objects have
fictitious pages.)

Revision 1.239: download - view: text, markup, annotated - select for diffs
Thu Jan 3 07:34:34 2008 UTC (4 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.238: preferred, colored
Changes since revision 1.238: +5 -4 lines
Add an access type parameter to pmap_enter().  It will be used to implement
superpage promotion.

Correct a style error in kmem_malloc(): pmap_enter()'s last parameter is
a Boolean.

Revision 1.238: download - view: text, markup, annotated - select for diffs
Sat Dec 29 19:53:04 2007 UTC (4 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.237: preferred, colored
Changes since revision 1.237: +14 -1 lines
Add the superpage reservation system.  This is "part 2 of 2" of the
machine-independent support for superpages.  (The earlier part was
the rewrite of the physical memory allocator.)  The remainder of the
code required for superpages support is machine-dependent and will
be added to the various pmap implementations at a later date.

Initially, I am only supporting one large page size per architecture.
Moreover, I am only enabling the reservation system on amd64.  (In
an emergency, it can be disabled by setting VM_NRESERVLEVELS to 0
in amd64/include/vmparam.h or your kernel configuration file.)

Revision 1.205.2.8: download - view: text, markup, annotated - select for diffs
Mon Nov 5 16:18:00 2007 UTC (4 years, 3 months ago) by ups
Branches: RELENG_6
CVS tags: RELENG_6_4_BP, RELENG_6_3_BP, RELENG_6_3_0_RELEASE, RELENG_6_3
Branch point for: RELENG_6_4
Diff to: previous 1.205.2.7: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.7: +2 -4 lines
MFC: 	Remove mpte optimization from pmap_enter_quick().
	There is a race with the current locking scheme and removing
	it should have no measurable performance impact.
	This fixes page faults leading to panics in pmap_enter_quick_locked()
	on amd64/i386.

Requested by: alc@

Revision 1.237: download - view: text, markup, annotated - select for diffs
Mon Oct 8 20:09:53 2007 UTC (4 years, 4 months ago) by kib
Branches: MAIN
CVS tags: RELENG_7_BP, RELENG_7_1_BP, RELENG_7_0_BP, RELENG_7_0_0_RELEASE, RELENG_7_0
Branch point for: RELENG_7_1, RELENG_7
Diff to: previous 1.236: preferred, colored
Changes since revision 1.236: +2 -3 lines
Do not dereference NULL pointer.

Reported by:	Peter Holm
Reviewed by:	alc
Approved by:	re (kensmith)

Revision 1.236: download - view: text, markup, annotated - select for diffs
Tue Sep 25 06:25:06 2007 UTC (4 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.235: preferred, colored
Changes since revision 1.235: +8 -21 lines
Change the management of cached pages (PQ_CACHE) in two fundamental
ways:

(1) Cached pages are no longer kept in the object's resident page
splay tree and memq.  Instead, they are kept in a separate per-object
splay tree of cached pages.  However, access to this new per-object
splay tree is synchronized by the _free_ page queues lock, not to be
confused with the heavily contended page queues lock.  Consequently, a
cached page can be reclaimed by vm_page_alloc(9) without acquiring the
object's lock or the page queues lock.

This solves a problem independently reported by tegge@ and Isilon.
Specifically, they observed the page daemon consuming a great deal of
CPU time because of pages bouncing back and forth between the cache
queue (PQ_CACHE) and the inactive queue (PQ_INACTIVE).  The source of
this problem turned out to be a deadlock avoidance strategy employed
when selecting a cached page to reclaim in vm_page_select_cache().
However, the root cause was really that reclaiming a cached page
required the acquisition of an object lock while the page queues lock
was already held.  Thus, this change addresses the problem at its
root, by eliminating the need to acquire the object's lock.

Moreover, keeping cached pages in the object's primary splay tree and
memq was, in effect, optimizing for the uncommon case.  Cached pages
are reclaimed far, far more often than they are reactivated.  Instead,
this change makes reclamation cheaper, especially in terms of
synchronization overhead, and reactivation more expensive, because
reactivated pages will have to be reentered into the object's primary
splay tree and memq.

(2) Cached pages are now stored alongside free pages in the physical
memory allocator's buddy queues, increasing the likelihood that large
allocations of contiguous physical memory (i.e., superpages) will
succeed.

Finally, as a result of this change long-standing restrictions on when
and where a cached page can be reclaimed and returned by
vm_page_alloc(9) are eliminated.  Specifically, calls to
vm_page_alloc(9) specifying VM_ALLOC_INTERRUPT can now reclaim and
return a formerly cached page.  Consequently, a call to malloc(9)
specifying M_NOWAIT is less likely to fail.

Discussed with: many over the course of the summer, including jeff@,
   Justin Husted @ Isilon, peter@, tegge@
Tested by: an earlier version by kris@
Approved by: re (kensmith)

Revision 1.205.2.7: download - view: text, markup, annotated - select for diffs
Sat Aug 25 18:43:16 2007 UTC (4 years, 5 months ago) by alc
Branches: RELENG_6
Diff to: previous 1.205.2.6: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.6: +11 -28 lines
MFC revision 1.234
  Eliminate the special case handling of OBJT_DEVICE objects in
  vm_fault_additional_pages() that was introduced in revision 1.47.  Then
  as now, it is unnecessary because dev_pager_haspage() returns zero for
  both the number of pages to read ahead and read behind, producing the
  same exact behavior by vm_fault_additional_pages() as the special case
  handling.

MFC revision 1.235
  Two changes to vm_fault_additional_pages():

  1. Rewrite the backward scan.  Specifically, reverse the order in which
     pages are allocated so that upon failure it is never necessary to
     free pages that were just allocated.  Moreover, any allocated pages
     can be put to use.  This makes the backward scan behave just like the
     forward scan.

  2. Eliminate an explicit, unsynchronized check for low memory before
     calling vm_page_alloc().  It serves no useful purpose.  It is, in
     effect, optimizing the uncommon case at the expense of the common
     case.

Revision 1.205.2.6: download - view: text, markup, annotated - select for diffs
Sat Aug 25 05:47:44 2007 UTC (4 years, 5 months ago) by alc
Branches: RELENG_6
Diff to: previous 1.205.2.5: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.5: +10 -7 lines
MFC revision 1.233
  When a cached page is reactivated in vm_fault(), update the counter that
  tracks the total number of reactivated pages.  (We have not been
  counting reactivations by vm_fault() since revision 1.46.)

  Correct a comment in vm_fault_additional_pages().

Revision 1.235: download - view: text, markup, annotated - select for diffs
Fri Jul 20 06:55:11 2007 UTC (4 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.234: preferred, colored
Changes since revision 1.234: +11 -19 lines
Two changes to vm_fault_additional_pages():

1. Rewrite the backward scan.  Specifically, reverse the order in which
   pages are allocated so that upon failure it is never necessary to
   free pages that were just allocated.  Moreover, any allocated pages
   can be put to use.  This makes the backward scan behave just like the
   forward scan.

2. Eliminate an explicit, unsynchronized check for low memory before
   calling vm_page_alloc().  It serves no useful purpose.  It is, in
   effect, optimizing the uncommon case at the expense of the common
   case.

Approved by:	re (hrs)
MFC after:	3 weeks

Revision 1.234: download - view: text, markup, annotated - select for diffs
Sun Jul 8 19:42:52 2007 UTC (4 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.233: preferred, colored
Changes since revision 1.233: +0 -10 lines
Eliminate the special case handling of OBJT_DEVICE objects in
vm_fault_additional_pages() that was introduced in revision 1.47.  Then
as now, it is unnecessary because dev_pager_haspage() returns zero for
both the number of pages to read ahead and read behind, producing the
same exact behavior by vm_fault_additional_pages() as the special case
handling.

Approved by: re (rwatson)

Revision 1.233: download - view: text, markup, annotated - select for diffs
Fri Jul 6 21:25:21 2007 UTC (4 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.232: preferred, colored
Changes since revision 1.232: +10 -8 lines
When a cached page is reactivated in vm_fault(), update the counter that
tracks the total number of reactivated pages.  (We have not been
counting reactivations by vm_fault() since revision 1.46.)

Correct a comment in vm_fault_additional_pages().

Approved by:	re (kensmith)
MFC after:	1 week

Revision 1.232: download - view: text, markup, annotated - select for diffs
Sun Jun 17 04:14:27 2007 UTC (4 years, 7 months ago) by mjacob
Branches: MAIN
Diff to: previous 1.231: preferred, colored
Changes since revision 1.231: +1 -1 lines
Initialize reqpage to zero.

Revision 1.231: download - view: text, markup, annotated - select for diffs
Mon Jun 4 21:38:48 2007 UTC (4 years, 8 months ago) by attilio
Branches: MAIN
Diff to: previous 1.230: preferred, colored
Changes since revision 1.230: +6 -6 lines
Rework the PCPU_* (MD) interface:
- Rename PCPU_LAZY_INC into PCPU_INC
- Add the PCPU_ADD interface which just does an add on the pcpu member
  given a specific value.

Note that for most architectures PCPU_INC and PCPU_ADD are not safe.
This is a point that needs some discussions/work in the next days.

Reviewed by: alc, bde
Approved by: jeff (mentor)

Revision 1.230: download - view: text, markup, annotated - select for diffs
Fri Jun 1 01:12:45 2007 UTC (4 years, 8 months ago) by jeff
Branches: MAIN
Diff to: previous 1.229: preferred, colored
Changes since revision 1.229: +4 -9 lines
 - Move rusage from being per-process in struct pstats to per-thread in
   td_ru.  This removes the requirement for per-process synchronization in
   statclock() and mi_switch().  This was previously supported by
   sched_lock which is going away.  All modifications to rusage are now
   done in the context of the owning thread.  reads proceed without locks.
 - Aggregate exiting threads rusage in thread_exit() such that the exiting
   thread's rusage is not lost.
 - Provide a new routine, rufetch() to fetch an aggregate of all rusage
   structures from all threads in a process.  This routine must be used
   in any place requiring a rusage from a process prior to it's exit.  The
   exited process's rusage is still available via p_ru.
 - Aggregate tick statistics only on demand via rufetch() or when a thread
   exits.  Tick statistics are kept in the thread and protected by sched_lock
   until it exits.

Initial patch by:	attilio
Reviewed by:		attilio, bde (some objections), arch (mostly silent)

Revision 1.229: download - view: text, markup, annotated - select for diffs
Thu May 31 22:52:15 2007 UTC (4 years, 8 months ago) by attilio
Branches: MAIN
Diff to: previous 1.228: preferred, colored
Changes since revision 1.228: +1 -2 lines
Revert VMCNT_* operations introduction.
Probabilly, a general approach is not the better solution here, so we should
solve the sched_lock protection problems separately.

Requested by: alc
Approved by: jeff (mentor)

Revision 1.228: download - view: text, markup, annotated - select for diffs
Tue May 22 04:45:59 2007 UTC (4 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.227: preferred, colored
Changes since revision 1.227: +3 -3 lines
Eliminate the reactivation of cached pages in vm_fault_prefault() and
vm_map_pmap_enter() unless the caller is madvise(MADV_WILLNEED).  With
the exception of calls to vm_map_pmap_enter() from
madvise(MADV_WILLNEED), vm_fault_prefault() and vm_map_pmap_enter()
are both used to create speculative mappings.  Thus, always
reactivating cached pages is a mistake.  In principle, cached pages
should only be reactivated by an actual access.  Otherwise, the
following misbehavior can occur.  On a hard fault for a text page the
clustering algorithm fetches not only the required page but also
several of the adjacent pages.  Now, suppose that one or more of the
adjacent pages are never accessed.  Ultimately, these unused pages
become cached pages through the efforts of the page daemon.  However,
the next activation of the executable reactivates and maps these
unused pages.  Consequently, they are never replaced.  In effect, they
become pinned in memory.

Revision 1.227: download - view: text, markup, annotated - select for diffs
Fri May 18 07:10:48 2007 UTC (4 years, 8 months ago) by jeff
Branches: MAIN
Diff to: previous 1.226: preferred, colored
Changes since revision 1.226: +2 -1 lines
 - define and use VMCNT_{GET,SET,ADD,SUB,PTR} macros for manipulating
   vmcnts.  This can be used to abstract away pcpu details but also changes
   to use atomics for all counters now.  This means sched lock is no longer
   responsible for protecting counts in the switch routines.

Contributed by:		Attilio Rao <attilio@FreeBSD.org>

Revision 1.226: download - view: text, markup, annotated - select for diffs
Thu Apr 5 20:49:46 2007 UTC (4 years, 10 months ago) by pjd
Branches: MAIN
Diff to: previous 1.225: preferred, colored
Changes since revision 1.225: +2 -0 lines
Fix a problem for file systems that don't implement VOP_BMAP() operation.

The problem is this: vm_fault_additional_pages() calls vm_pager_has_page(),
which calls vnode_pager_haspage(). Now when VOP_BMAP() returns an error (eg.
EOPNOTSUPP), vnode_pager_haspage() returns TRUE without initializing 'before'
and 'after' arguments, so we have some accidental values there. This bascially
was causing this condition to be meet:

	if ((rahead + rbehind) >
	    ((cnt.v_free_count + cnt.v_cache_count) - cnt.v_free_reserved)) {
		pagedaemon_wakeup();
		[...]
	}

(we have some random values in rahead and rbehind variables)

I'm not entirely sure this is the right fix, maybe we should just return FALSE
in vnode_pager_haspage() when VOP_BMAP() fails?

alc@ knows about this problem, maybe he will be able to come up with a better
fix if this is not the right one.

Revision 1.225: download - view: text, markup, annotated - select for diffs
Fri Mar 23 06:11:25 2007 UTC (4 years, 10 months ago) by alc
Branches: MAIN
Diff to: previous 1.224: preferred, colored
Changes since revision 1.224: +2 -2 lines
vm_page_busy() no longer requires the page queues lock to be held.  Reduce
the scope of the page queues lock in vm_fault() accordingly.

Revision 1.224: download - view: text, markup, annotated - select for diffs
Mon Mar 5 18:55:14 2007 UTC (4 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.223: preferred, colored
Changes since revision 1.223: +6 -6 lines
Use PCPU_LAZY_INC() to update page fault statistics.

Revision 1.223: download - view: text, markup, annotated - select for diffs
Sun Nov 12 21:48:34 2006 UTC (5 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.222: preferred, colored
Changes since revision 1.222: +2 -7 lines
Make pmap_enter() responsible for setting PG_WRITEABLE instead
of its caller.  (As a beneficial side-effect, a high-contention
acquisition of the page queues lock in vm_fault() is eliminated.)

Revision 1.222: download - view: text, markup, annotated - select for diffs
Mon Oct 23 05:27:31 2006 UTC (5 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.221: preferred, colored
Changes since revision 1.221: +3 -3 lines
The page queues lock is no longer required by vm_page_wakeup().

Revision 1.221: download - view: text, markup, annotated - select for diffs
Sun Oct 22 04:28:14 2006 UTC (5 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.220: preferred, colored
Changes since revision 1.220: +8 -7 lines
Replace PG_BUSY with VPO_BUSY.  In other words, changes to the page's
busy flag, i.e., VPO_BUSY, are now synchronized by the per-vm object
lock instead of the global page queues lock.

Revision 1.220: download - view: text, markup, annotated - select for diffs
Sat Oct 21 21:02:04 2006 UTC (5 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.219: preferred, colored
Changes since revision 1.219: +1 -1 lines
Eliminate unnecessary PG_BUSY tests.  They originally served a purpose
that is now handled by vm object locking.

Revision 1.219: download - view: text, markup, annotated - select for diffs
Sun Aug 13 00:11:09 2006 UTC (5 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.218: preferred, colored
Changes since revision 1.218: +5 -5 lines
Reimplement the page's NOSYNC flag as an object-synchronized instead of a
page queues-synchronized flag.  Reduce the scope of the page queues lock in
vm_fault() accordingly.

Move vm_fault()'s call to vm_object_set_writeable_dirty() outside of the
scope of the page queues lock.  Reviewed by: tegge
Additionally, eliminate an unnecessary dereference in computing the
argument that is passed to vm_object_set_writeable_dirty().

Revision 1.218: download - view: text, markup, annotated - select for diffs
Sun Aug 6 00:17:17 2006 UTC (5 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.217: preferred, colored
Changes since revision 1.217: +2 -4 lines
Eliminate the acquisition and release of the page queues lock around a call
to vm_page_sleep_if_busy().

Revision 1.217: download - view: text, markup, annotated - select for diffs
Fri Jul 21 23:22:49 2006 UTC (5 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.216: preferred, colored
Changes since revision 1.216: +1 -7 lines
Retire debug.mpsafevm.  None of the architectures supported in CVS require
it any longer.

Revision 1.216: download - view: text, markup, annotated - select for diffs
Thu Jun 15 01:01:06 2006 UTC (5 years, 7 months ago) by ups
Branches: MAIN
Diff to: previous 1.215: preferred, colored
Changes since revision 1.215: +2 -4 lines
Remove mpte optimization from pmap_enter_quick().
There is a race with the current locking scheme and removing
it should have no measurable performance impact.
This fixes page faults leading to panics in pmap_enter_quick_locked()
on amd64/i386.

Reviewed by: alc,jhb,peter,ps

Revision 1.205.2.5: download - view: text, markup, annotated - select for diffs
Mon Jun 12 15:06:22 2006 UTC (5 years, 8 months ago) by maxim
Branches: RELENG_6
CVS tags: RELENG_6_2_BP, RELENG_6_2_0_RELEASE, RELENG_6_2
Diff to: previous 1.205.2.4: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.4: +1 -1 lines
MFC rev. 1.213: fix a comment.

Revision 1.215: download - view: text, markup, annotated - select for diffs
Sat May 13 20:05:44 2006 UTC (5 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.214: preferred, colored
Changes since revision 1.214: +5 -12 lines
Simplify the implementation of vm_fault_additional_pages() based upon the
object's memq being ordered.  Specifically, replace repeated calls to
vm_page_lookup() by two simple constant-time operations.

Reviewed by: tegge

Revision 1.205.2.4: download - view: text, markup, annotated - select for diffs
Wed Mar 8 23:53:39 2006 UTC (5 years, 11 months ago) by tegge
Branches: RELENG_6
CVS tags: RELENG_6_1_BP, RELENG_6_1_0_RELEASE, RELENG_6_1
Diff to: previous 1.205.2.3: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.3: +3 -1 lines
MFC: Don't access fs->first_object after dropping reference to it.
     The result could be a missed or extra giant unlock.

Approved by:	re (mux)

Revision 1.214: download - view: text, markup, annotated - select for diffs
Wed Mar 8 06:31:46 2006 UTC (5 years, 11 months ago) by imp
Branches: MAIN
Diff to: previous 1.213: preferred, colored
Changes since revision 1.213: +2 -2 lines
Remove leading __ from __(inline|const|signed|volatile).  They are
obsolete.  This should reduce diffs to NetBSD as well.

Revision 1.213: download - view: text, markup, annotated - select for diffs
Thu Feb 2 21:55:38 2006 UTC (6 years ago) by tegge
Branches: MAIN
Diff to: previous 1.212: preferred, colored
Changes since revision 1.212: +1 -1 lines
Adjust old comment (present in rev 1.1) to match changes in rev 1.82.

PR:	kern/92509
Submitted by:   "Bryan Venteicher" <bryanv@daemoninthecloset.org>

Revision 1.212: download - view: text, markup, annotated - select for diffs
Fri Jan 27 08:35:32 2006 UTC (6 years ago) by alc
Branches: MAIN
Diff to: previous 1.211: preferred, colored
Changes since revision 1.211: +2 -2 lines
Use the new macros abstracting the page coloring/queues implementation.
(There are no functional changes.)

Revision 1.211: download - view: text, markup, annotated - select for diffs
Sat Dec 31 14:39:20 2005 UTC (6 years, 1 month ago) by netchild
Branches: MAIN
Diff to: previous 1.210: preferred, colored
Changes since revision 1.210: +3 -2 lines
MI changes:
 - provide an interface (macros) to the page coloring part of the VM system,
   this allows to try different coloring algorithms without the need to
   touch every file [1]
 - make the page queue tuning values readable: sysctl vm.stats.pagequeue
 - autotuning of the page coloring values based upon the cache size instead
   of options in the kernel config (disabling of the page coloring as a
   kernel option is still possible)

MD changes:
 - detection of the cache size: only IA32 and AMD64 (untested) contains
   cache size detection code, every other arch just comes with a dummy
   function (this results in the use of default values like it was the
   case without the autotuning of the page coloring)
 - print some more info on Intel CPU's (like we do on AMD and Transmeta
   CPU's)

Note to AMD owners (IA32 and AMD64): please run "sysctl vm.stats.pagequeue"
and report if the cache* values are zero (= bug in the cache detection code)
or not.

Based upon work by:	Chad David <davidc@acns.ab.ca> [1]
Reviewed by:		alc, arch (in 2004)
Discussed with:		alc, Chad David, arch (in 2004)

Revision 1.210: download - view: text, markup, annotated - select for diffs
Tue Dec 20 12:27:59 2005 UTC (6 years, 1 month ago) by tegge
Branches: MAIN
Diff to: previous 1.209: preferred, colored
Changes since revision 1.209: +3 -1 lines
Don't access fs->first_object after dropping reference to it.
The result could be a missed or extra giant unlock.

Reviewed by:	alc

Revision 1.209: download - view: text, markup, annotated - select for diffs
Sun Dec 11 22:06:57 2005 UTC (6 years, 2 months ago) by alc
Branches: MAIN
Diff to: previous 1.208: preferred, colored
Changes since revision 1.208: +0 -1 lines
Remove unneeded calls to pmap_remove_all().  The given page is not mapped.

Reviewed by: tegge

Revision 1.205.2.3: download - view: text, markup, annotated - select for diffs
Sun Nov 13 21:45:48 2005 UTC (6 years, 2 months ago) by alc
Branches: RELENG_6
Diff to: previous 1.205.2.2: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.2: +2 -1 lines
MFC
  Pass a value of type vm_prot_t to pmap_enter_quick() so that it determine
  whether the mapping should permit execute access.

  Revision  Changes    Path
  1.179     +2 -2      src/sys/alpha/alpha/pmap.c
  1.527     +4 -2      src/sys/amd64/amd64/pmap.c
  1.37      +3 -3      src/sys/arm/arm/pmap.c
  1.531     +2 -2      src/sys/i386/i386/pmap.c
  1.163     +4 -3      src/sys/ia64/ia64/pmap.c
  1.100     +3 -2      src/sys/powerpc/powerpc/pmap.c
  1.149     +3 -2      src/sys/sparc64/sparc64/pmap.c
  1.72      +1 -1      src/sys/vm/pmap.h
  1.207     +2 -1      src/sys/vm/vm_fault.c
  1.368     +2 -2      src/sys/vm/vm_map.c

Revision 1.205.2.2: download - view: text, markup, annotated - select for diffs
Sun Oct 9 03:08:28 2005 UTC (6 years, 4 months ago) by delphij
Branches: RELENG_6
CVS tags: RELENG_6_0_BP, RELENG_6_0_0_RELEASE, RELENG_6_0
Diff to: previous 1.205.2.1: preferred, colored; branchpoint 1.205: preferred, colored
Changes since revision 1.205.2.1: +1 -1 lines
MFC (by alc)
| Eliminate an incorrect cast.
|
| Revision  Changes    Path
| 1.208     +1 -1      src/sys/vm/vm_fault.c

Approved by:	re (scottl)

Revision 1.208: download - view: text, markup, annotated - select for diffs
Wed Sep 7 01:42:30 2005 UTC (6 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.207: preferred, colored
Changes since revision 1.207: +1 -1 lines
Eliminate an incorrect cast.

Revision 1.207: download - view: text, markup, annotated - select for diffs
Sat Sep 3 18:20:20 2005 UTC (6 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.206: preferred, colored
Changes since revision 1.206: +2 -1 lines
Pass a value of type vm_prot_t to pmap_enter_quick() so that it determine
whether the mapping should permit execute access.

Revision 1.205.2.1: download - view: text, markup, annotated - select for diffs
Mon Jul 18 19:53:21 2005 UTC (6 years, 6 months ago) by jhb
Branches: RELENG_6
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +1 -1 lines
MFC: Fix instant panics when booting with debug.mpsafevm=0 by fixing up
an old test.

Approved by:	re (kensmith)

Revision 1.206: download - view: text, markup, annotated - select for diffs
Thu Jul 14 21:18:07 2005 UTC (6 years, 6 months ago) by jhb
Branches: MAIN
Diff to: previous 1.205: preferred, colored
Changes since revision 1.205: +1 -1 lines
Convert a remaining !fs.map->system_map to
fs.first_object->flags & OBJ_NEEDGIANT test that was missed in an earlier
revision.  This fixes mutex assertion failures in the debug.mpsafevm=0
case.

Reported by:	ps
MFC after:	3 days

Revision 1.205: download - view: text, markup, annotated - select for diffs
Thu May 12 04:09:41 2005 UTC (6 years, 9 months ago) by grehan
Branches: MAIN
CVS tags: RELENG_6_BP
Branch point for: RELENG_6
Diff to: previous 1.204: preferred, colored
Changes since revision 1.204: +1 -1 lines
The final test in unlock_and_deallocate() to determine if GIANT needs to be
unlocked wasn't updated to check for OBJ_NEEDGIANT. This caused a WITNESS
panic when debug_mpsafevm was set to 0.

Approved by:	jeffr

Revision 1.204: download - view: text, markup, annotated - select for diffs
Tue May 3 11:11:26 2005 UTC (6 years, 9 months ago) by jeff
Branches: MAIN
Diff to: previous 1.203: preferred, colored
Changes since revision 1.203: +9 -4 lines
 - Add a new object flag "OBJ_NEEDSGIANT".  We set this flag if the
   underlying vnode requires Giant.
 - In vm_fault only acquire Giant if the underlying object has NEEDSGIANT
   set.
 - In vm_object_shadow inherit the NEEDSGIANT flag from the backing object.

Revision 1.192.2.4: download - view: text, markup, annotated - select for diffs
Sat Feb 26 20:23:20 2005 UTC (6 years, 11 months ago) by alc
Branches: RELENG_5
CVS tags: RELENG_5_5_BP, RELENG_5_5_0_RELEASE, RELENG_5_5, RELENG_5_4_BP, RELENG_5_4_0_RELEASE, RELENG_5_4
Diff to: previous 1.192.2.3: preferred, colored; branchpoint 1.192: preferred, colored; next MAIN 1.193: preferred, colored
Changes since revision 1.192.2.3: +29 -11 lines
MFC revision 1.201
 Continue the transition from synchronizing access to the page's PG_BUSY
 flag and busy field with the global page queues lock to synchronizing
 their access with the containing object's lock.  Specifically, acquire the
 containing object's lock before reading the page's PG_BUSY flag and busy
 field in vm_fault().

Revision 1.192.2.3: download - view: text, markup, annotated - select for diffs
Mon Jan 31 23:27:02 2005 UTC (7 years ago) by imp
Branches: RELENG_5
Diff to: previous 1.192.2.2: preferred, colored; branchpoint 1.192: preferred, colored
Changes since revision 1.192.2.2: +1 -1 lines
MFC: /*- and related license changes

Revision 1.203: download - view: text, markup, annotated - select for diffs
Mon Jan 24 10:48:29 2005 UTC (7 years ago) by jeff
Branches: MAIN
Diff to: previous 1.202: preferred, colored
Changes since revision 1.202: +6 -2 lines
 - Remove GIANT_REQUIRED where giant is no longer required.
 - Use VFS_LOCK_GIANT() rather than directly acquiring giant in places
   where giant is only held because vfs requires it.

Sponsored By:   Isilon Systems, Inc.

Revision 1.202: download - view: text, markup, annotated - select for diffs
Fri Jan 7 02:29:27 2005 UTC (7 years, 1 month ago) by imp
Branches: MAIN
Diff to: previous 1.201: preferred, colored
Changes since revision 1.201: +1 -1 lines
/* -> /*- for license, minor formatting changes

Revision 1.201: download - view: text, markup, annotated - select for diffs
Fri Dec 24 19:31:54 2004 UTC (7 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.200: preferred, colored
Changes since revision 1.200: +29 -11 lines
Continue the transition from synchronizing access to the page's PG_BUSY
flag and busy field with the global page queues lock to synchronizing their
access with the containing object's lock.  Specifically, acquire the
containing object's lock before reading the page's PG_BUSY flag and busy
field in vm_fault().

Reviewed by: tegge@

Revision 1.200: download - view: text, markup, annotated - select for diffs
Thu Dec 23 20:16:11 2004 UTC (7 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.199: preferred, colored
Changes since revision 1.199: +3 -4 lines
Modify pmap_enter_quick() so that it expects the page queues to be locked
on entry and it assumes the responsibility for releasing the page queues
lock if it must sleep.

Remove a bogus comment from pmap_enter_quick().

Using the first change, modify vm_map_pmap_enter() so that the page queues
lock is acquired and released once, rather than each time that a page
is mapped.

Revision 1.199: download - view: text, markup, annotated - select for diffs
Wed Dec 15 19:55:05 2004 UTC (7 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.198: preferred, colored
Changes since revision 1.198: +2 -8 lines
In the common case, pmap_enter_quick() completes without sleeping.
In such cases, the busying of the page and the unlocking of the
containing object by vm_map_pmap_enter() and vm_fault_prefault() is
unnecessary overhead.  To eliminate this overhead, this change
modifies pmap_enter_quick() so that it expects the object to be locked
on entry and it assumes the responsibility for busying the page and
unlocking the object if it must sleep.  Note: alpha, amd64, i386 and
ia64 are the only implementations optimized by this change; arm,
powerpc, and sparc64 still conservatively busy the page and unlock the
object within every pmap_enter_quick() call.

Additionally, this change is the first case where we synchronize
access to the page's PG_BUSY flag and busy field using the containing
object's lock rather than the global page queues lock.  (Modifications
to the page's PG_BUSY flag and busy field have asserted both locks for
several weeks, enabling an incremental transition.)

Revision 1.192.2.2: download - view: text, markup, annotated - select for diffs
Sun Dec 12 01:43:40 2004 UTC (7 years, 2 months ago) by alc
Branches: RELENG_5
Diff to: previous 1.192.2.1: preferred, colored; branchpoint 1.192: preferred, colored
Changes since revision 1.192.2.1: +0 -4 lines
MFC revision 1.195
 In vm_fault_unwire() eliminate the acquisition and release of Giant in the
 case of non-kernel pmaps.

Revision 1.192.2.1: download - view: text, markup, annotated - select for diffs
Sun Nov 28 00:36:57 2004 UTC (7 years, 2 months ago) by alc
Branches: RELENG_5
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +11 -7 lines
MFC revision 1.198
 Remove unnecessary check for curthread == NULL.

MFC revision 1.197
 System maps are prohibited from mapping vnode-backed objects.  Take
 advantage of this restriction to avoid acquiring and releasing Giant when
 wiring pages within a system map.

MFC revisions 1.193 and 1.194
 Further reduce the use of Giant by vm_fault(): Giant is held only when
 manipulating a vnode, e.g., calling vput().  This reduces contention for
 Giant during many copy-on-write faults, resulting in some additional
 speedup on SMPs.

Revision 1.108.2.10: download - view: text, markup, annotated - select for diffs
Tue Nov 16 19:48:09 2004 UTC (7 years, 2 months ago) by ps
Branches: RELENG_4
CVS tags: RELENG_4_11_BP, RELENG_4_11_0_RELEASE, RELENG_4_11
Diff to: previous 1.108.2.9: preferred, colored; branchpoint 1.108: preferred, colored; next MAIN 1.109: preferred, colored
Changes since revision 1.108.2.9: +10 -52 lines
MFC:
>alc         2004/05/21 21:53:52 PDT
>
>  FreeBSD src repository
>
>  Modified files:
>    sys/vm               vm_extern.h vm_fault.c vm_map.c vm_page.c
>  Log:
>    To date, unwiring a fictitious page has produced a panic.  The reason
>    being that PHYS_TO_VM_PAGE() returns the wrong vm_page for fictitious
>    pages but unwiring uses PHYS_TO_VM_PAGE().  The resulting panic
>    reported an unexpected wired count.  Rather than attempting to fix
>    PHYS_TO_VM_PAGE(), this fix takes advantage of the properties of
>    fictitious pages.  Specifically, fictitious pages will never be
>    completely unwired.  Therefore, we can keep a fictitious page's wired
>    count forever set to one and thereby avoid the use of
>    PHYS_TO_VM_PAGE() when we know that we're working with a fictitious
>    page, just not which one.
>
>    In collaboration with: green@, tegge@
>    PR: kern/29915

Reviewed by:	alc

Revision 1.198: download - view: text, markup, annotated - select for diffs
Sun Oct 17 20:29:28 2004 UTC (7 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.197: preferred, colored
Changes since revision 1.197: +1 -1 lines
Remove unnecessary check for curthread == NULL.

Revision 1.197: download - view: text, markup, annotated - select for diffs
Sat Sep 11 18:49:59 2004 UTC (7 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.196: preferred, colored
Changes since revision 1.196: +8 -8 lines
System maps are prohibited from mapping vnode-backed objects.  Take
advantage of this restriction to avoid acquiring and releasing Giant when
wiring pages within a system map.

In collaboration with: tegge@

Revision 1.196: download - view: text, markup, annotated - select for diffs
Fri Sep 3 05:11:32 2004 UTC (7 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.195: preferred, colored
Changes since revision 1.195: +4 -0 lines
Push Giant deep into vm_forkproc(), acquiring it only if the process has
mapped System V shared memory segments (see shmfork_myhook()) or requires
the allocation of an ldt (see vm_fault_wire()).

Revision 1.195: download - view: text, markup, annotated - select for diffs
Wed Sep 1 19:18:59 2004 UTC (7 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.194: preferred, colored
Changes since revision 1.194: +0 -4 lines
In vm_fault_unwire() eliminate the acquisition and release of Giant in the
case of non-kernel pmaps.

Revision 1.194: download - view: text, markup, annotated - select for diffs
Sun Aug 22 00:08:43 2004 UTC (7 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.193: preferred, colored
Changes since revision 1.193: +2 -1 lines
In the previous revision, I failed to condition an early release of Giant
in vm_fault() on debug_mpsafevm.  If debug_mpsafevm was not set, the result
was an assertion failure early in the boot process.

Reported by: green@

Revision 1.193: download - view: text, markup, annotated - select for diffs
Sat Aug 21 19:20:21 2004 UTC (7 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.192: preferred, colored
Changes since revision 1.192: +3 -4 lines
Further reduce the use of Giant by vm_fault(): Giant is held only when
manipulating a vnode, e.g., calling vput().  This reduces contention for
Giant during many copy-on-write faults, resulting in some additional
speedup on SMPs.

Note: debug_mpsafevm must be enabled for this optimization to take effect.

Revision 1.192: download - view: text, markup, annotated - select for diffs
Mon Aug 16 06:16:12 2004 UTC (7 years, 5 months ago) by alc
Branches: MAIN
CVS tags: RELENG_5_BP, RELENG_5_3_BP, RELENG_5_3_0_RELEASE, RELENG_5_3
Branch point for: RELENG_5
Diff to: previous 1.191: preferred, colored
Changes since revision 1.191: +11 -7 lines
 - Introduce and use a new tunable "debug.mpsafevm".  At present, setting
   "debug.mpsafevm" results in (almost) Giant-free execution of zero-fill
   page faults.  (Giant is held only briefly, just long enough to determine
   if there is a vnode backing the faulting address.)

   Also, condition the acquisition and release of Giant around calls to
   pmap_remove() on "debug.mpsafevm".

   The effect on performance is significant.  On my dual Opteron, I see a
   3.6% reduction in "buildworld" time.

 - Use atomic operations to update several counters in vm_fault().

Revision 1.191: download - view: text, markup, annotated - select for diffs
Thu Aug 12 20:14:49 2004 UTC (7 years, 6 months ago) by tegge
Branches: MAIN
Diff to: previous 1.190: preferred, colored
Changes since revision 1.190: +37 -51 lines
The vm map lock is needed in vm_fault() after the page has been found,
to avoid later changes before pmap_enter() and vm_fault_prefault()
has completed.

Simplify deadlock avoidance by not blocking on vm map relookup.

In collaboration with: alc

Revision 1.190: download - view: text, markup, annotated - select for diffs
Mon Aug 9 18:46:39 2004 UTC (7 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.189: preferred, colored
Changes since revision 1.189: +7 -16 lines
Make two changes to vm_fault().
1. Move a comment to its proper place, updating it.  (Except for white-
   space, this comment had been unchanged since revision 1.1!)
2. Remove spl calls.

Revision 1.189: download - view: text, markup, annotated - select for diffs
Mon Aug 9 06:01:46 2004 UTC (7 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.188: preferred, colored
Changes since revision 1.188: +6 -11 lines
Make two changes to vm_fault().
1. Retain the map lock until after the calls to pmap_enter() and
   vm_fault_prefault().
2. Remove a stale comment.  Submitted by: tegge@

Revision 1.188: download - view: text, markup, annotated - select for diffs
Sat May 22 04:53:51 2004 UTC (7 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.187: preferred, colored
Changes since revision 1.187: +10 -11 lines
To date, unwiring a fictitious page has produced a panic.  The reason
being that PHYS_TO_VM_PAGE() returns the wrong vm_page for fictitious
pages but unwiring uses PHYS_TO_VM_PAGE().  The resulting panic
reported an unexpected wired count.  Rather than attempting to fix
PHYS_TO_VM_PAGE(), this fix takes advantage of the properties of
fictitious pages.  Specifically, fictitious pages will never be
completely unwired.  Therefore, we can keep a fictitious page's wired
count forever set to one and thereby avoid the use of
PHYS_TO_VM_PAGE() when we know that we're working with a fictitious
page, just not which one.

In collaboration with: green@, tegge@
PR: kern/29915

Revision 1.187: download - view: text, markup, annotated - select for diffs
Thu May 6 05:03:23 2004 UTC (7 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.186: preferred, colored
Changes since revision 1.186: +0 -1 lines
Make vm_page's PG_ZERO flag immutable between the time of the page's
allocation and deallocation.  This flag's principal use is shortly after
allocation.  For such cases, clearing the flag is pointless.  The only
unusual use of PG_ZERO is in vfs_bio_clrbuf().  However, allocbuf() never
requests a prezeroed page.  So, vfs_bio_clrbuf() never sees a prezeroed
page.

Reviewed by:	tegge@

Revision 1.186: download - view: text, markup, annotated - select for diffs
Wed Mar 10 04:44:43 2004 UTC (7 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.185: preferred, colored
Changes since revision 1.185: +4 -2 lines
 - Make the acquisition of Giant in vm_fault_unwire() conditional on the
   pmap.  For the kernel pmap, Giant is not required.  In general, for
   other pmaps, Giant is required by i386's pmap_pte() implementation.
   Specifically, the use of PMAP2/PADDR2 is synchronized by Giant.
   Note: In principle, updates to the kernel pmap's wired count could be
   lost without Giant.  However, in practice, we never use the kernel
   pmap's wired count.  This will be resolved when pmap locking appears.
 - With the above change, cpu_thread_clean() and uma_large_free() need
   not acquire Giant.  (The first case is simply the revival of
   i386/i386/vm_machdep.c's revision 1.226 by peter.)

Revision 1.185: download - view: text, markup, annotated - select for diffs
Sun Feb 15 00:42:26 2004 UTC (7 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.184: preferred, colored
Changes since revision 1.184: +1 -3 lines
Correct a long-standing race condition in vm_fault() that could result in a
panic "vm_page_cache: caching a dirty page, ...": Access to the page must
be restricted or removed before calling vm_page_cache().  This race
condition is identical in nature to that which was addressed by
vm_pageout.c's revision 1.251 and vm_page.c's revision 1.275.

Reviewed by:	tegge
MFC after:	7 days

Revision 1.184: download - view: text, markup, annotated - select for diffs
Thu Feb 5 06:33:18 2004 UTC (8 years ago) by alc
Branches: MAIN
Diff to: previous 1.183: preferred, colored
Changes since revision 1.183: +0 -2 lines
 - Locking for the per-process resource limits structure has eliminated
   the need for Giant in vm_map_growstack().
 - Use the proc * that is passed to vm_map_growstack() rather than
   curthread->td_proc.

Revision 1.183: download - view: text, markup, annotated - select for diffs
Fri Dec 26 23:33:37 2003 UTC (8 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.182: preferred, colored
Changes since revision 1.182: +10 -14 lines
 - Reduce Giant's scope in vm_fault().
 - Use vm_object_reference_locked() instead of vm_object_reference()
   in vm_fault().

Revision 1.182: download - view: text, markup, annotated - select for diffs
Mon Nov 10 00:44:00 2003 UTC (8 years, 3 months ago) by mini
Branches: MAIN
CVS tags: RELENG_5_2_BP, RELENG_5_2_1_RELEASE, RELENG_5_2_0_RELEASE, RELENG_5_2
Diff to: previous 1.181: preferred, colored
Changes since revision 1.181: +1 -1 lines
NFC: Update stale comments.

Reviewed by:	alc

Revision 1.181: download - view: text, markup, annotated - select for diffs
Wed Oct 15 08:00:45 2003 UTC (8 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.180: preferred, colored
Changes since revision 1.180: +19 -5 lines
 - vm_fault_copy_entry() should not assume that the source object contains
   every page.  If the source entry was read-only, one or more wired pages
   could be in backing objects.
 - vm_fault_copy_entry() should not set the PG_WRITEABLE flag on the page
   unless the destination entry is, in fact, writeable.

Revision 1.180: download - view: text, markup, annotated - select for diffs
Wed Oct 8 07:11:19 2003 UTC (8 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.179: preferred, colored
Changes since revision 1.179: +7 -2 lines
Lock the destination object in vm_fault_copy_entry().

Revision 1.179: download - view: text, markup, annotated - select for diffs
Wed Oct 8 05:35:12 2003 UTC (8 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.178: preferred, colored
Changes since revision 1.178: +4 -2 lines
Retire vm_page_copy().  Its reason for being ended when peter@ modified
pmap_copy_page() et al. to accept a vm_page_t rather than a physical
address.  Also, this change will facilitate locking access to the vm page's
valid field.

Revision 1.178: download - view: text, markup, annotated - select for diffs
Sat Oct 4 21:35:48 2003 UTC (8 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.177: preferred, colored
Changes since revision 1.177: +8 -4 lines
Synchronize access to a vm page's valid field using the containing
vm object's lock.

Revision 1.177: download - view: text, markup, annotated - select for diffs
Fri Oct 3 22:46:53 2003 UTC (8 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.176: preferred, colored
Changes since revision 1.176: +91 -1 lines
Migrate pmap_prefault() into the machine-independent virtual memory layer.

A small helper function pmap_is_prefaultable() is added.  This function
encapsulate the few lines of pmap_prefault() that actually vary from
machine to machine.  Note: pmap_is_prefaultable() and pmap_mincore() have
much in common.  Going forward, it's worth considering their merger.

Revision 1.176: download - view: text, markup, annotated - select for diffs
Thu Sep 18 02:26:03 2003 UTC (8 years, 4 months ago) by alc
Branches: MAIN
Diff to: previous 1.175: preferred, colored
Changes since revision 1.175: +1 -1 lines
Add vm object locking to vnode_pager_lock().  (This triggers the movement
of a VM_OBJECT_LOCK() in vm_fault().)

Revision 1.175: download - view: text, markup, annotated - select for diffs
Sat Aug 23 06:52:32 2003 UTC (8 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.174: preferred, colored
Changes since revision 1.174: +10 -8 lines
To implement the sequential access optimization, vm_fault() may need to
reacquire the "first" object's lock while a backing object's lock is held.
Since this is a lock-order reversal, vm_fault() uses trylock to acquire
the first object's lock, skipping the sequential access optimization in
the unlikely event that the trylock fails.

Revision 1.108.2.9: download - view: text, markup, annotated - select for diffs
Sat Aug 9 16:21:20 2003 UTC (8 years, 6 months ago) by luoqi
Branches: RELENG_4
CVS tags: RELENG_4_9_BP, RELENG_4_9_0_RELEASE, RELENG_4_9, RELENG_4_10_BP, RELENG_4_10_0_RELEASE, RELENG_4_10
Diff to: previous 1.108.2.8: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.8: +4 -3 lines
MFC: PAE support, based on Jake Burkholder's work in current. Jake's
work was sponsored by DARPA, Network Associates Laboratories.

Major changes include:
- introduction of vm_paddr_t to represent physical address
- support for page directory pointer table
- removal of (recursive) alternative address space

Reviewed by:	jake

Revision 1.174: download - view: text, markup, annotated - select for diffs
Sun Jun 22 21:35:41 2003 UTC (8 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.173: preferred, colored
Changes since revision 1.173: +9 -10 lines
Maintain a lock on the vm object of interest throughout vm_fault(),
releasing the lock only if we are about to sleep (e.g., vm_pager_get_pages()
or vm_pager_has_pages()).  If we sleep, we have marked the vm object with
the paging-in-progress flag.

Revision 1.173: download - view: text, markup, annotated - select for diffs
Sun Jun 22 05:36:53 2003 UTC (8 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.172: preferred, colored
Changes since revision 1.172: +8 -8 lines
As vm_fault() descends the chain of backing objects, set paging-in-
progress on the next object before clearing it on the current object.

Revision 1.172: download - view: text, markup, annotated - select for diffs
Sun Jun 22 00:00:11 2003 UTC (8 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.171: preferred, colored
Changes since revision 1.171: +5 -10 lines
Make some style and white-space changes to the copy-on-write path through
vm_fault(); remove a pointless assignment statement from that path.

Revision 1.171: download - view: text, markup, annotated - select for diffs
Sat Jun 21 06:31:42 2003 UTC (8 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.170: preferred, colored
Changes since revision 1.170: +5 -2 lines
Lock one of the vm objects involved in an optimized copy-on-write fault.

Revision 1.170: download - view: text, markup, annotated - select for diffs
Fri Jun 20 04:20:36 2003 UTC (8 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.169: preferred, colored
Changes since revision 1.169: +2 -9 lines
The so-called "optimized copy-on-write fault" case should not require
the vm map lock.  What's really needed is vm object locking, which
is (for the moment) provided Giant.

Reviewed by:	tegge

Revision 1.169: download - view: text, markup, annotated - select for diffs
Thu Jun 19 01:40:44 2003 UTC (8 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.168: preferred, colored
Changes since revision 1.168: +1 -1 lines
Fix a vm object reference leak in the page-based copy-on-write mechanism
used by the zero-copy sockets implementation.

Reviewed by:	gallatin

Revision 1.168: download - view: text, markup, annotated - select for diffs
Wed Jun 11 23:50:50 2003 UTC (8 years, 8 months ago) by obrien
Branches: MAIN
Diff to: previous 1.167: preferred, colored
Changes since revision 1.167: +4 -2 lines
Use __FBSDID().

Revision 1.167: download - view: text, markup, annotated - select for diffs
Tue Apr 22 20:01:56 2003 UTC (8 years, 9 months ago) by jhb
Branches: MAIN
CVS tags: RELENG_5_1_BP, RELENG_5_1_0_RELEASE, RELENG_5_1
Diff to: previous 1.166: preferred, colored
Changes since revision 1.166: +4 -3 lines
Prefer the proc lock to sched_lock when testing PS_INMEM now that it is
safe to do so.

Revision 1.166: download - view: text, markup, annotated - select for diffs
Sun Apr 20 19:25:28 2003 UTC (8 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.165: preferred, colored
Changes since revision 1.165: +10 -0 lines
 - Lock the vm_object when performing vm_object_pip_wakeup().

Revision 1.165: download - view: text, markup, annotated - select for diffs
Sun Apr 20 03:41:21 2003 UTC (8 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.164: preferred, colored
Changes since revision 1.164: +4 -0 lines
 - Lock the vm_object when performing vm_object_pip_add().

Revision 1.164: download - view: text, markup, annotated - select for diffs
Tue Mar 25 00:07:05 2003 UTC (8 years, 10 months ago) by jake
Branches: MAIN
Diff to: previous 1.163: preferred, colored
Changes since revision 1.163: +3 -2 lines
- Add vm_paddr_t, a physical address type.  This is required for systems
  where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)

Revision 1.163: download - view: text, markup, annotated - select for diffs
Sat Mar 8 06:58:18 2003 UTC (8 years, 11 months ago) by ken
Branches: MAIN
Diff to: previous 1.162: preferred, colored
Changes since revision 1.162: +9 -2 lines
Zero copy send and receive fixes:

- On receive, vm_map_lookup() needs to trigger the creation of a shadow
  object.  To make that happen, call vm_map_lookup() with PROT_WRITE
  instead of PROT_READ in vm_pgmoveco().

- On send, a shadow object will be created by the vm_map_lookup() in
  vm_fault(), but vm_page_cowfault() will delete the original page from
  the backing object rather than simply letting the legacy COW mechanism
  take over.  In other words, the new page should be added to the shadow
  object rather than replacing the old page in the backing object.  (i.e.
  vm_page_cowfault() should not be called in this case.)  We accomplish
  this by making sure fs.object == fs.first_object before calling
  vm_page_cowfault() in vm_fault().

Submitted by:	gallatin, alc
Tested by:	ken

Revision 1.162: download - view: text, markup, annotated - select for diffs
Thu Mar 6 03:41:01 2003 UTC (8 years, 11 months ago) by alc
Branches: MAIN
Diff to: previous 1.161: preferred, colored
Changes since revision 1.161: +0 -7 lines
Remove ENABLE_VFS_IOOPT.  It is a long unfinished work-in-progress.

Discussed on:	arch@

Revision 1.161: download - view: text, markup, annotated - select for diffs
Thu Jan 16 00:02:21 2003 UTC (9 years ago) by dillon
Branches: MAIN
Diff to: previous 1.160: preferred, colored
Changes since revision 1.160: +18 -0 lines
Merge all the various copies of vm_fault_quick() into a single
portable copy.

Revision 1.160: download - view: text, markup, annotated - select for diffs
Sun Jan 12 07:33:16 2003 UTC (9 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.159: preferred, colored
Changes since revision 1.159: +0 -3 lines
vm_fault_copy_entry() needn't clear PG_ZERO because it didn't pass
VM_ALLOC_ZERO to vm_page_alloc().

Revision 1.159: download - view: text, markup, annotated - select for diffs
Sun Dec 29 07:17:06 2002 UTC (9 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.158: preferred, colored
Changes since revision 1.158: +0 -2 lines
Reduce the number of times that we acquire and release the page queues
lock by making vm_page_rename()'s caller, rather than vm_page_rename(),
responsible for acquiring it.

Revision 1.158: download - view: text, markup, annotated - select for diffs
Tue Dec 24 19:02:03 2002 UTC (9 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.157: preferred, colored
Changes since revision 1.157: +2 -0 lines
 - Hold the page queues lock around calls to vm_page_flag_clear().

Revision 1.157: download - view: text, markup, annotated - select for diffs
Thu Dec 19 01:20:24 2002 UTC (9 years, 1 month ago) by alc
Branches: MAIN
Diff to: previous 1.156: preferred, colored
Changes since revision 1.156: +7 -1 lines
 - Hold the page queues lock when performing vm_page_busy() or
   vm_page_flag_set().
 - Replace vm_page_sleep_busy() with proper page queues locking
   and vm_page_sleep_if_busy().

Revision 1.156: download - view: text, markup, annotated - select for diffs
Sat Nov 16 07:44:25 2002 UTC (9 years, 2 months ago) by alc
Branches: MAIN
CVS tags: RELENG_5_0_BP, RELENG_5_0_0_RELEASE, RELENG_5_0
Diff to: previous 1.155: preferred, colored
Changes since revision 1.155: +2 -2 lines
Now that pmap_remove_all() is exported by our pmap implementations
use it directly.

Revision 1.155: download - view: text, markup, annotated - select for diffs
Sun Nov 10 07:12:04 2002 UTC (9 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.154: preferred, colored
Changes since revision 1.154: +2 -2 lines
When prot is VM_PROT_NONE, call pmap_page_protect() directly rather than
indirectly through vm_page_protect().  The one remaining page flag that
is updated by vm_page_protect() is already being updated by our various
pmap implementations.

Note: A later commit will similarly change the VM_PROT_READ case and
eliminate vm_page_protect().

Revision 1.154: download - view: text, markup, annotated - select for diffs
Sat Oct 19 18:34:39 2002 UTC (9 years, 3 months ago) by alc
Branches: MAIN
Diff to: previous 1.153: preferred, colored
Changes since revision 1.153: +2 -2 lines
Complete the page queues locking needed for the page-based copy-
on-write (COW) mechanism.  (This mechanism is used by the zero-copy
TCP/IP implementation.)
 - Extend the scope of the page queues lock in vm_fault()
   to cover vm_page_cowfault().
 - Modify vm_page_cowfault() to release the page queues lock
   if it sleeps.

Revision 1.153: download - view: text, markup, annotated - select for diffs
Sun Aug 25 04:20:05 2002 UTC (9 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.152: preferred, colored
Changes since revision 1.152: +0 -12 lines
 o Retire pmap_pageable().  It's an advisory routine that none
   of our platforms implements.

Revision 1.152: download - view: text, markup, annotated - select for diffs
Sun Aug 25 00:22:31 2002 UTC (9 years, 5 months ago) by alc
Branches: MAIN
Diff to: previous 1.151: preferred, colored
Changes since revision 1.151: +1 -1 lines
 o Retire vm_page_zero_fill() and vm_page_zero_fill_area().  Ever since
   pmap_zero_page() and pmap_zero_page_area() were modified to accept
   a struct vm_page * instead of a physical address, vm_page_zero_fill()
   and vm_page_zero_fill_area() have served no purpose.

Revision 1.151: download - view: text, markup, annotated - select for diffs
Sat Aug 10 23:27:06 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.150: preferred, colored
Changes since revision 1.150: +1 -1 lines
 o Move a call to vm_page_wakeup() inside the scope of the page queues lock.

Revision 1.150: download - view: text, markup, annotated - select for diffs
Sat Aug 10 07:11:16 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.149: preferred, colored
Changes since revision 1.149: +2 -2 lines
 o Remove the setting and clearing of the PG_MAPPED flag.  (This flag is
   obsolete.)

Revision 1.149: download - view: text, markup, annotated - select for diffs
Sat Jul 27 07:20:27 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.148: preferred, colored
Changes since revision 1.148: +6 -0 lines
 o Lock page queue accesses by vm_page_activate().

Revision 1.148: download - view: text, markup, annotated - select for diffs
Wed Jul 24 19:47:56 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.147: preferred, colored
Changes since revision 1.147: +8 -49 lines
 o Merge vm_fault_wire() and vm_fault_user_wire() by adding a new parameter,
   user_wire.

Revision 1.147: download - view: text, markup, annotated - select for diffs
Sun Jul 21 21:20:57 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.146: preferred, colored
Changes since revision 1.146: +12 -0 lines
 o Lock page queue accesses by vm_page_free() and vm_page_deactivate().

Revision 1.146: download - view: text, markup, annotated - select for diffs
Sat Jul 20 19:34:21 2002 UTC (9 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.145: preferred, colored
Changes since revision 1.145: +2 -1 lines
 o Lock page queue accesses by vm_page_cache() in vm_fault() and
   vm_pageout_scan().  (The others are already locked.)
 o Assert that the page queues lock is held in vm_page_cache().

Revision 1.145: download - view: text, markup, annotated - select for diffs
Sat Jul 13 19:24:04 2002 UTC (9 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.144: preferred, colored
Changes since revision 1.144: +4 -1 lines
 o Lock some page queue accesses, in particular, those by vm_page_unwire().

Revision 1.144: download - view: text, markup, annotated - select for diffs
Wed Jun 26 03:34:55 2002 UTC (9 years, 7 months ago) by ken
Branches: MAIN
Diff to: previous 1.143: preferred, colored
Changes since revision 1.143: +14 -0 lines
At long last, commit the zero copy sockets code.

MAKEDEV:	Add MAKEDEV glue for the ti(4) device nodes.

ti.4:		Update the ti(4) man page to include information on the
		TI_JUMBO_HDRSPLIT and TI_PRIVATE_JUMBOS kernel options,
		and also include information about the new character
		device interface and the associated ioctls.

man9/Makefile:	Add jumbo.9 and zero_copy.9 man pages and associated
		links.

jumbo.9:	New man page describing the jumbo buffer allocator
		interface and operation.

zero_copy.9:	New man page describing the general characteristics of
		the zero copy send and receive code, and what an
		application author should do to take advantage of the
		zero copy functionality.

NOTES:		Add entries for ZERO_COPY_SOCKETS, TI_PRIVATE_JUMBOS,
		TI_JUMBO_HDRSPLIT, MSIZE, and MCLSHIFT.

conf/files:	Add uipc_jumbo.c and uipc_cow.c.

conf/options:	Add the 5 options mentioned above.

kern_subr.c:	Receive side zero copy implementation.  This takes
		"disposable" pages attached to an mbuf, gives them to
		a user process, and then recycles the user's page.
		This is only active when ZERO_COPY_SOCKETS is turned on
		and the kern.ipc.zero_copy.receive sysctl variable is
		set to 1.

uipc_cow.c:	Send side zero copy functions.  Takes a page written
		by the user and maps it copy on write and assigns it
		kernel virtual address space.  Removes copy on write
		mapping once the buffer has been freed by the network
		stack.

uipc_jumbo.c:	Jumbo disposable page allocator code.  This allocates
		(optionally) disposable pages for network drivers that
		want to give the user the option of doing zero copy
		receive.

uipc_socket.c:	Add kern.ipc.zero_copy.{send,receive} sysctls that are
		enabled if ZERO_COPY_SOCKETS is turned on.

		Add zero copy send support to sosend() -- pages get
		mapped into the kernel instead of getting copied if
		they meet size and alignment restrictions.

uipc_syscalls.c:Un-staticize some of the sf* functions so that they
		can be used elsewhere.  (uipc_cow.c)

if_media.c:	In the SIOCGIFMEDIA ioctl in ifmedia_ioctl(), avoid
		calling malloc() with M_WAITOK.  Return an error if
		the M_NOWAIT malloc fails.

		The ti(4) driver and the wi(4) driver, at least, call
		this with a mutex held.  This causes witness warnings
		for 'ifconfig -a' with a wi(4) or ti(4) board in the
		system.  (I've only verified for ti(4)).

ip_output.c:	Fragment large datagrams so that each segment contains
		a multiple of PAGE_SIZE amount of data plus headers.
		This allows the receiver to potentially do page
		flipping on receives.

if_ti.c:	Add zero copy receive support to the ti(4) driver.  If
		TI_PRIVATE_JUMBOS is not defined, it now uses the
		jumbo(9) buffer allocator for jumbo receive buffers.

		Add a new character device interface for the ti(4)
		driver for the new debugging interface.  This allows
		(a patched version of) gdb to talk to the Tigon board
		and debug the firmware.  There are also a few additional
		debugging ioctls available through this interface.

		Add header splitting support to the ti(4) driver.

		Tweak some of the default interrupt coalescing
		parameters to more useful defaults.

		Add hooks for supporting transmit flow control, but
		leave it turned off with a comment describing why it
		is turned off.

if_tireg.h:	Change the firmware rev to 12.4.11, since we're really
		at 12.4.11 plus fixes from 12.4.13.

		Add defines needed for debugging.

		Remove the ti_stats structure, it is now defined in
		sys/tiio.h.

ti_fw.h:	12.4.11 firmware.

ti_fw2.h:	12.4.11 firmware, plus selected fixes from 12.4.13,
		and my header splitting patches.  Revision 12.4.13
		doesn't handle 10/100 negotiation properly.  (This
		firmware is the same as what was in the tree previously,
		with the addition of header splitting support.)

sys/jumbo.h:	Jumbo buffer allocator interface.

sys/mbuf.h:	Add a new external mbuf type, EXT_DISPOSABLE, to
		indicate that the payload buffer can be thrown away /
		flipped to a userland process.

socketvar.h:	Add prototype for socow_setup.

tiio.h:		ioctl interface to the character portion of the ti(4)
		driver, plus associated structure/type definitions.

uio.h:		Change prototype for uiomoveco() so that we'll know
		whether the source page is disposable.

ufs_readwrite.c:Update for new prototype of uiomoveco().

vm_fault.c:	In vm_fault(), check to see whether we need to do a page
		based copy on write fault.

vm_object.c:	Add a new function, vm_object_allocate_wait().  This
		does the same thing that vm_object allocate does, except
		that it gives the caller the opportunity to specify whether
		it should wait on the uma_zalloc() of the object structre.

		This allows vm objects to be allocated while holding a
		mutex.  (Without generating WITNESS warnings.)

		vm_object_allocate() is implemented as a call to
		vm_object_allocate_wait() with the malloc flag set to
		M_WAITOK.

vm_object.h:	Add prototype for vm_object_allocate_wait().

vm_page.c:	Add page-based copy on write setup, clear and fault
		routines.

vm_page.h:	Add page based COW function prototypes and variable in
		the vm_page structure.

Many thanks to Drew Gallatin, who wrote the zero copy send and receive
code, and to all the other folks who have tested and reviewed this code
over the years.

Revision 1.143: download - view: text, markup, annotated - select for diffs
Sun Jun 16 20:42:29 2002 UTC (9 years, 7 months ago) by alc
Branches: MAIN
Diff to: previous 1.142: preferred, colored
Changes since revision 1.142: +1 -5 lines
 o Remove GIANT_REQUIRED from vm_fault_user_wire().
 o Move pmap_pageable() outside of Giant in vm_fault_unwire().
   (pmap_pageable() is a no-op on all supported architectures.)
 o Remove the acquisition and release of Giant from mlock().

Revision 1.142: download - view: text, markup, annotated - select for diffs
Sun May 26 04:54:56 2002 UTC (9 years, 8 months ago) by alc
Branches: MAIN
Diff to: previous 1.141: preferred, colored
Changes since revision 1.141: +2 -1 lines
 o Acquire and release Giant around pmap operations in vm_fault_unwire()
   and vm_map_delete().  Assert GIANT_REQUIRED in vm_map_delete()
   only if operating on the kernel_object or the kmem_object.
 o Remove GIANT_REQUIRED from vm_map_remove().
 o Remove the acquisition and release of Giant from munmap().

Revision 1.141: download - view: text, markup, annotated - select for diffs
Mon May 6 05:45:57 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.140: preferred, colored
Changes since revision 1.140: +2 -1 lines
 o Condition the compilation and use of vm_freeze_copyopts()
   on ENABLE_VFS_IOOPT.

Revision 1.140: download - view: text, markup, annotated - select for diffs
Tue Apr 30 03:44:34 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.139: preferred, colored
Changes since revision 1.139: +11 -16 lines
 o Revert vm_fault1() to its original name vm_fault(), eliminating the wrapper
   that took its place for the purposes of acquiring and releasing Giant.

Revision 1.139: download - view: text, markup, annotated - select for diffs
Mon Apr 29 05:23:01 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.138: preferred, colored
Changes since revision 1.138: +8 -0 lines
Document three synchronization issues in vm_fault().

Revision 1.138: download - view: text, markup, annotated - select for diffs
Sun Apr 28 06:07:54 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.137: preferred, colored
Changes since revision 1.137: +1 -3 lines
 o Introduce and use vm_map_trylock() to replace several direct uses
   of lockmgr().
 o Add missing synchronization to vmspace_swap_count(): Obtain a read lock
   on the vm_map before traversing it.

Revision 1.137: download - view: text, markup, annotated - select for diffs
Fri Apr 19 04:20:31 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.136: preferred, colored
Changes since revision 1.136: +8 -12 lines
 o Move the acquisition of Giant from vm_fault() to the point
   after initialization in vm_fault1().
 o Fix some style problems in vm_fault1().

Revision 1.136: download - view: text, markup, annotated - select for diffs
Thu Apr 18 03:55:50 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.135: preferred, colored
Changes since revision 1.135: +3 -0 lines
Add a comment documenting a race condition in vm_fault(): Specifically, a
modification is made to the vm_map while only a read lock is held.

Revision 1.135: download - view: text, markup, annotated - select for diffs
Thu Apr 18 03:28:27 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.134: preferred, colored
Changes since revision 1.134: +10 -1 lines
 o Call vm_map_growstack() from vm_fault() if vm_map_lookup() has failed
   due to conditions that suggest the possible need for stack growth.
   This has two beneficial effects: (1) we can
   now remove calls to vm_map_growstack() from the MD trap handlers and (2)
   simple page faults are faster because we no longer unnecessarily perform
   vm_map_growstack() on every page fault.
 o Remove vm_map_growstack() from the i386's trap_pfault().
 o Remove the acquisition and release of Giant from i386's trap_pfault().
   (vm_fault() still acquires it.)

Revision 1.134: download - view: text, markup, annotated - select for diffs
Wed Apr 17 02:23:57 2002 UTC (9 years, 9 months ago) by alc
Branches: MAIN
Diff to: previous 1.133: preferred, colored
Changes since revision 1.133: +0 -2 lines
Remove an unused option, VM_FAULT_HOLD, to vm_fault().

Revision 1.133: download - view: text, markup, annotated - select for diffs
Tue Mar 19 22:17:45 2002 UTC (9 years, 10 months ago) by alfred
Branches: MAIN
Diff to: previous 1.132: preferred, colored
Changes since revision 1.132: +2 -3 lines
Remove __P.

Revision 1.132: download - view: text, markup, annotated - select for diffs
Mon Mar 18 15:08:07 2002 UTC (9 years, 10 months ago) by green
Branches: MAIN
Diff to: previous 1.131: preferred, colored
Changes since revision 1.131: +10 -16 lines
Back out the modification of vm_map locks from lockmgr to sx locks.  The
best path forward now is likely to change the lockmgr locks to simple
sleep mutexes, then see if any extra contention it generates is greater
than removed overhead of managing local locking state information,
cost of extra calls into lockmgr, etc.

Additionally, making the vm_map lock a mutex and respecting it properly
will put us much closer to not needing Giant magic in vm.

Revision 1.131: download - view: text, markup, annotated - select for diffs
Thu Mar 14 02:10:14 2002 UTC (9 years, 11 months ago) by green
Branches: MAIN
Diff to: previous 1.130: preferred, colored
Changes since revision 1.130: +14 -10 lines
Document faultstate.lookup_still_valid more than none.

Requested by:	alfred

Revision 1.130: download - view: text, markup, annotated - select for diffs
Wed Mar 13 23:48:08 2002 UTC (9 years, 11 months ago) by green
Branches: MAIN
Diff to: previous 1.129: preferred, colored
Changes since revision 1.129: +7 -5 lines
Rename SI_SUB_MUTEX to SI_SUB_MTX_POOL to make the name at all accurate.
While doing this, move it earlier in the sysinit boot process so that the
VM system can use it.

After that, the system is now able to use sx locks instead of lockmgr
locks in the VM system.  To accomplish this, some of the more
questionable uses of the locks (such as testing whether they are
owned or not, as well as allowing shared+exclusive recursion) are
removed, and simpler logic throughout is used so locks should also be
easier to understand.

This has been tested on my laptop for months, and has not shown any
problems on SMP systems, either, so appears quite safe.  One more
user of lockmgr down, many more to go :)

Revision 1.129: download - view: text, markup, annotated - select for diffs
Sun Mar 10 21:52:46 2002 UTC (9 years, 11 months ago) by eivind
Branches: MAIN
Diff to: previous 1.128: preferred, colored
Changes since revision 1.128: +9 -44 lines
- Remove a number of extra newlines that do not belong here according to
  style(9)
- Minor space adjustment in cases where we have "( ", " )", if(), return(),
  while(), for(), etc.
- Add /* SYMBOL */ after a few #endifs.

Reviewed by:	alc

Revision 1.108.2.8: download - view: text, markup, annotated - select for diffs
Tue Feb 26 05:49:27 2002 UTC (9 years, 11 months ago) by silby
Branches: RELENG_4
CVS tags: RELENG_4_8_BP, RELENG_4_8_0_RELEASE, RELENG_4_8, RELENG_4_7_BP, RELENG_4_7_0_RELEASE, RELENG_4_7, RELENG_4_6_BP, RELENG_4_6_2_RELEASE, RELENG_4_6_1_RELEASE, RELENG_4_6_0_RELEASE, RELENG_4_6
Diff to: previous 1.108.2.7: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.7: +2 -2 lines
MFC OOM killer changes:

  Changes to make the OOM killer much more effective:

  - Allow the OOM killer to target processes currently locked in
    memory.  These very often are the ones doing the memory hogging.
  - Drop the wakeup priority of processes currently sleeping while
    waiting for their page fault to complete.  In order for the OOM
    killer to work well, the killed process and other system processes
    waiting on memory must be allowed to wakeup first.

  Revision  Changes    Path
  1.128     +2 -2      src/sys/vm/vm_fault.c
  1.176     +23 -0     src/sys/vm/vm_page.c
  1.188     +1 -2      src/sys/vm/vm_pageout.c
  1.28      +3 -1      src/sys/vm/vm_pageout.h

Revision 1.128: download - view: text, markup, annotated - select for diffs
Tue Feb 19 18:34:02 2002 UTC (9 years, 11 months ago) by silby
Branches: MAIN
Diff to: previous 1.127: preferred, colored
Changes since revision 1.127: +2 -2 lines
Changes to make the OOM killer much more effective:

- Allow the OOM killer to target processes currently locked in
  memory.  These very often are the ones doing the memory hogging.
- Drop the wakeup priority of processes currently sleeping while
  waiting for their page fault to complete.  In order for the OOM
  killer to work well, the killed process and other system processes
  waiting on memory must be allowed to wakeup first.

Reviewed by:	dillon
MFC after:	1 week

Revision 1.108.2.7: download - view: text, markup, annotated - select for diffs
Sat Nov 17 01:02:47 2001 UTC (10 years, 2 months ago) by dillon
Branches: RELENG_4
CVS tags: RELENG_4_5_BP, RELENG_4_5_0_RELEASE, RELENG_4_5
Diff to: previous 1.108.2.6: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.6: +5 -1 lines
MFC 1.127 - fix a deadlock that can occur in certain situations when a
mmap()'d file is truncated.

Submitted by:	peter, ps

Revision 1.127: download - view: text, markup, annotated - select for diffs
Fri Nov 9 21:34:45 2001 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.126: preferred, colored
Changes since revision 1.126: +5 -1 lines
Fix deadlock introduced in 1.73 (Jan 1998).  The paging-in-progress count
on a vnode-backed object must be incremented *after* obtaining the vnode
lock.  If it is bumped before obtaining the vnode lock we can deadlock
against vtruncbuf().

Submitted by:	peter, ps
MFC after:	3 days

Revision 1.108.2.6: download - view: text, markup, annotated - select for diffs
Sat Nov 3 19:59:28 2001 UTC (10 years, 3 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.108.2.5: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.5: +2 -3 lines
MFC implement kern.maxvnodes (primarily kern/vfs_subr.c 1.326), sync,
and other VM optimizations and fixes.

* Add VOBJDIRTY flag to vnode to avoid certain indirections.
* Turn the mount structure vnode list into an LRU queue (LIST -> TAILQ)
* Attempt to reuse vnodes when we hit the maxvnodes limit
* Optimize msync() to avoid unnecessary v_interlocks
* Optimize ffs_sync() for same
* Fix vm_object double-termination bug
* Add KASSERT to ensure that backing object is not freed out from
  under remaining VM pages.

These fixes change the mount structure and will create a binary kld module
incompatibility with filesystem kld's, but I deem the scaling issues with
4.x that we are fixing to be more important.

Revision 1.126: download - view: text, markup, annotated - select for diffs
Fri Oct 26 00:08:05 2001 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
Diff to: previous 1.125: preferred, colored
Changes since revision 1.125: +2 -3 lines
Implement kern.maxvnodes.  adjusting kern.maxvnodes now actually has a
real effect.

Optimize vfs_msync().  Avoid having to continually drop and re-obtain
mutexes when scanning the vnode list.  Improves looping case by 500%.

Optimize ffs_sync().  Avoid having to continually drop and re-obtain
mutexes when scanning the vnode list.  This makes a couple of assumptions,
which I believe are ok, in regards to vnode stability when the mount list
mutex is held.  Improves looping case by 500%.

(more optimization work is needed on top of these fixes)

MFC after:	1 week

Revision 1.125: download - view: text, markup, annotated - select for diffs
Wed Sep 12 08:38:11 2001 UTC (10 years, 5 months ago) by julian
Branches: MAIN
CVS tags: KSE_MILESTONE_2
Diff to: previous 1.124: preferred, colored
Changes since revision 1.124: +2 -2 lines
KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha

Revision 1.124: download - view: text, markup, annotated - select for diffs
Wed Jul 4 23:27:08 2001 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
CVS tags: KSE_PRE_MILESTONE_2
Diff to: previous 1.123: preferred, colored
Changes since revision 1.123: +2 -2 lines
Reorg vm_page.c into vm_page.c, vm_pageq.c, and vm_contig.c (for contigmalloc).
Also removed some spl's and added some VM mutexes, but they are not actually
used yet, so this commit does not really make any operational changes
to the system.

vm_page.c relates to vm_page_t manipulation, including high level deactivation,
activation, etc...  vm_pageq.c relates to finding free pages and aquiring
exclusive access to a page queue (exclusivity part not yet implemented).
And the world still builds... :-)

Revision 1.123: download - view: text, markup, annotated - select for diffs
Wed Jul 4 19:00:12 2001 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.122: preferred, colored
Changes since revision 1.122: +7 -7 lines
whitespace / register cleanup

Revision 1.122: download - view: text, markup, annotated - select for diffs
Wed Jul 4 16:20:27 2001 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.121: preferred, colored
Changes since revision 1.121: +12 -39 lines
With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage).  Also add various GIANT_ macros to
formalize the removal of Giant, making it easy to test in a more piecemeal
fashion. These macros will allow us to test fine-grained locks to a degree
before removing Giant, and also after, and to remove Giant in a piecemeal
fashion via sysctl's on those subsystems which the authors believe can
operate without Giant.

Revision 1.121: download - view: text, markup, annotated - select for diffs
Wed May 23 22:09:18 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.120: preferred, colored
Changes since revision 1.120: +7 -9 lines
Take a more conservative approach and still lock Giant around VM faults
for now.

Revision 1.120: download - view: text, markup, annotated - select for diffs
Tue May 22 00:56:25 2001 UTC (10 years, 8 months ago) by jhb
Branches: MAIN
Diff to: previous 1.119: preferred, colored
Changes since revision 1.119: +4 -4 lines
Sort includes.

Revision 1.119: download - view: text, markup, annotated - select for diffs
Sat May 19 01:28:08 2001 UTC (10 years, 8 months ago) by alfred
Branches: MAIN
Diff to: previous 1.118: preferred, colored
Changes since revision 1.118: +62 -5 lines
Introduce a global lock for the vm subsystem (vm_mtx).

vm_mtx does not recurse and is required for most low level
vm operations.

faults can not be taken without holding Giant.

Memory subsystems can now call the base page allocators safely.

Almost all atomic ops were removed as they are covered under the
vm mutex.

Alpha and ia64 now need to catch up to i386's trap handlers.

FFS and NFS have been tested, other filesystems will need minor
changes (grabbing the vm lock when twiddling page properties).

Reviewed (partially) by: jake, jhb

Revision 1.118: download - view: text, markup, annotated - select for diffs
Tue May 1 08:13:20 2001 UTC (10 years, 9 months ago) by markm
Branches: MAIN
Diff to: previous 1.117: preferred, colored
Changes since revision 1.117: +3 -2 lines
Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)

Revision 1.108.2.5: download - view: text, markup, annotated - select for diffs
Wed Mar 14 07:05:05 2001 UTC (10 years, 11 months ago) by dillon
Branches: RELENG_4
CVS tags: RELENG_4_4_BP, RELENG_4_4_0_RELEASE, RELENG_4_4, RELENG_4_3_BP, RELENG_4_3_0_RELEASE, RELENG_4_3
Diff to: previous 1.108.2.4: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.4: +7 -1 lines
MFC lock reversal fix related to threaded programs.

Submitted by: tegge
Tested by: tegge
Approved: jkh

Revision 1.117: download - view: text, markup, annotated - select for diffs
Wed Mar 14 06:48:53 2001 UTC (10 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.116: preferred, colored
Changes since revision 1.116: +7 -1 lines
Fix a lock reversal problem in the VM subsystem related to threaded
programs.   There is a case during a fork() which can cause a deadlock.

From Tor -
The workaround that consists of setting a flag in the vm map that
indicates that a fork is in progress and using that mark in the page
fault handling to force a revalidation failure.  That change will only
affect (pessimize) page fault handling during fork for threaded
(linuxthreads style) applications and applications using aio_*().

Submited by: tegge

Revision 1.108.2.4: download - view: text, markup, annotated - select for diffs
Fri Mar 2 16:42:46 2001 UTC (10 years, 11 months ago) by dillon
Branches: RELENG_4
Diff to: previous 1.108.2.3: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.3: +7 -7 lines
MFC 1.116 - VM fault resulting in writable page sets PG_NOSYNC properly,
even if it was not a write-fault.

Original Patch by: Andrew Gallatin

Revision 1.116: download - view: text, markup, annotated - select for diffs
Wed Feb 28 04:26:43 2001 UTC (10 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.115: preferred, colored
Changes since revision 1.115: +7 -7 lines
If we intend to make the page writable without requiring another fault,
make sure that PG_NOSYNC is properly set.  Previously we only set it
for a write-fault, but this can occur on a read-fault too.
(will be MFCd prior to 4.3 freeze)

Revision 1.115: download - view: text, markup, annotated - select for diffs
Fri Feb 9 06:11:43 2001 UTC (11 years ago) by bmilekic
Branches: MAIN
Diff to: previous 1.114: preferred, colored
Changes since revision 1.114: +3 -3 lines
Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)

Revision 1.108.2.3: download - view: text, markup, annotated - select for diffs
Sat Jan 27 20:54:19 2001 UTC (11 years ago) by dillon
Branches: RELENG_4
Diff to: previous 1.108.2.2: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.2: +4 -1 lines
MFC 1.113 - protect vm_pager_page_unswapped().

Revision 1.114: download - view: text, markup, annotated - select for diffs
Wed Jan 24 11:20:05 2001 UTC (11 years ago) by jhb
Branches: MAIN
Diff to: previous 1.113: preferred, colored
Changes since revision 1.113: +4 -2 lines
- Catch up to proc flag changes.

Revision 1.113: download - view: text, markup, annotated - select for diffs
Sat Nov 18 21:11:23 2000 UTC (11 years, 2 months ago) by dillon
Branches: MAIN
Diff to: previous 1.112: preferred, colored
Changes since revision 1.112: +4 -1 lines
Add the splvm()'s suggested in PR 20609 to protect vm_pager_page_unswapped().
The remainder of the PR is still open.

PR: kern/20609 (partial fix)

Revision 1.108.2.2: download - view: text, markup, annotated - select for diffs
Fri Aug 4 22:31:11 2000 UTC (11 years, 6 months ago) by peter
Branches: RELENG_4
CVS tags: RELENG_4_2_0_RELEASE, RELENG_4_1_1_RELEASE
Diff to: previous 1.108.2.1: preferred, colored; branchpoint 1.108: preferred, colored
Changes since revision 1.108.2.1: +4 -5 lines
MFC: pmap interface optimizations, optionally physically backed SYSVSHM.

Revision 1.108.2.1: download - view: text, markup, annotated - select for diffs
Wed Aug 2 22:04:29 2000 UTC (11 years, 6 months ago) by peter
Branches: RELENG_4
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +4 -4 lines
MFC: various minor spelling fixes

Revision 1.112: download - view: text, markup, annotated - select for diffs
Mon May 29 22:40:54 2000 UTC (11 years, 8 months ago) by dillon
Branches: MAIN
CVS tags: PRE_SMPNG
Diff to: previous 1.111: preferred, colored
Changes since revision 1.111: +2 -2 lines
    This is a cleanup patch to Peter's new OBJT_PHYS VM object type
    and sysv shared memory support for it.  It implements a new
    PG_UNMANAGED flag that has slightly different characteristics
    from PG_FICTICIOUS.

    A new sysctl, kern.ipc.shm_use_phys has been added to enable the
    use of physically-backed sysv shared memory rather then swap-backed.
    Physically backed shm segments are not tracked with PV entries,
    allowing programs which use a large shm segment as a rendezvous
    point to operate without eating an insane amount of KVM in the
    PV entry management.  Read: Oracle.

    Peter's OBJT_PHYS object will also allow us to eventually implement
    page-table sharing and/or 4MB physical page support for such segments.
    We're half way there.

Revision 1.111: download - view: text, markup, annotated - select for diffs
Sun May 21 12:50:17 2000 UTC (11 years, 8 months ago) by peter
Branches: MAIN
Diff to: previous 1.110: preferred, colored
Changes since revision 1.110: +3 -4 lines
Implement an optimization of the VM<->pmap API.  Pass vm_page_t's directly
to various pmap_*() functions instead of looking up the physical address
and passing that.  In many cases, the first thing the pmap code was doing
was going to a lot of trouble to get back the original vm_page_t, or
it's shadow pv_table entry.

Inspired by: John Dyson's 1998 patches.

Also:
Eliminate pv_table as a seperate thing and build it into a machine
dependent part of vm_page_t.  This eliminates having a seperate set of
structions that shadow each other in a 1:1 fashion that we often went to
a lot of trouble to translate from one to the other. (see above)
This happens to save 4 bytes of physical memory for each page in the
system.  (8 bytes on the Alpha).

Eliminate the use of the phys_avail[] array to determine if a page is
managed (ie: it has pv_entries etc).  Store this information in a flag.
Things like device_pager set it because they create vm_page_t's on the
fly that do not have pv_entries.  This makes it easier to "unmanage" a
page of physical memory (this will be taken advantage of in subsequent
commits).

Add a function to add a new page to the freelist.  This could be used
for reclaiming the previously wasted pages left over from preloaded
loader(8) files.

Reviewed by:	dillon

Revision 1.110: download - view: text, markup, annotated - select for diffs
Mon Mar 27 20:41:14 2000 UTC (11 years, 10 months ago) by charnier
Branches: MAIN
Diff to: previous 1.109: preferred, colored
Changes since revision 1.109: +3 -3 lines
Revert spelling mistake I made in the previous commit
Requested by: Alan and Bruce

Revision 1.109: download - view: text, markup, annotated - select for diffs
Sun Mar 26 15:20:21 2000 UTC (11 years, 10 months ago) by charnier
Branches: MAIN
Diff to: previous 1.108: preferred, colored
Changes since revision 1.108: +5 -5 lines
Spelling

Revision 1.108: download - view: text, markup, annotated - select for diffs
Sun Dec 12 03:19:28 1999 UTC (12 years, 2 months ago) by dillon
Branches: MAIN
CVS tags: RELENG_4_BP, RELENG_4_1_0_RELEASE, RELENG_4_0_0_RELEASE
Branch point for: RELENG_4
Diff to: previous 1.107: preferred, colored
Changes since revision 1.107: +17 -3 lines
    Add MAP_NOSYNC feature to mmap(), and MADV_NOSYNC and MADV_AUTOSYNC to
    madvise().

    This feature prevents the update daemon from gratuitously flushing
    dirty pages associated with a mapped file-backed region of memory.  The
    system pager will still page the memory as necessary and the VM system
    will still be fully coherent with the filesystem.  Modifications made
    by other means to the same area of memory, for example by write(), are
    unaffected.  The feature works on a page-granularity basis.

    MAP_NOSYNC allows one to use mmap() to share memory between processes
    without incuring any significant filesystem overhead, putting it in
    the same performance category as SysV Shared memory and anonymous memory.

Reviewed by: julian, alc, dg

Revision 1.107: download - view: text, markup, annotated - select for diffs
Fri Oct 29 18:09:28 1999 UTC (12 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.106: preferred, colored
Changes since revision 1.106: +1 -2 lines
useracc() the prequel:

Merge the contents (less some trivial bordering the silly comments)
of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>.  This puts
the #defines for the vm_inherit_t and vm_prot_t types next to their
typedefs.

This paves the road for the commit to follow shortly: change
useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE}
as argument.

Revision 1.106: download - view: text, markup, annotated - select for diffs
Tue Sep 21 00:36:16 1999 UTC (12 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.105: preferred, colored
Changes since revision 1.105: +44 -37 lines
    Final commit to remove vnode->v_lastr.  vm_fault now handles read
    clustering issues (replacing code that used to be in
    ufs/ufs/ufs_readwrite.c).  vm_fault also now uses the new VM page counter
    inlines.

    This completes the changeover from vnode->v_lastr to vm_entry_t->v_lastr
    for VM, and fp->f_nextread and fp->f_seqcount (which have been in the
    tree for a while).  Determination of the I/O strategy (sequential, random,
    and so forth) is now handled on a descriptor-by-descriptor basis for
    base I/O calls, and on a memory-region-by-memory-region and
    process-by-process basis for VM faults.

Reviewed by:	David Greenman <dg@root.com>, Alan Cox <alc@cs.rice.edu>

Revision 1.25.4.5: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:39:05 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.4: preferred, colored; branchpoint 1.25: preferred, colored; next MAIN 1.26: preferred, colored
Changes since revision 1.25.4.4: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.57.2.6: download - view: text, markup, annotated - select for diffs
Sun Sep 5 08:24:22 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_2_2
Diff to: previous 1.57.2.5: preferred, colored; branchpoint 1.57: preferred, colored; next MAIN 1.58: preferred, colored
Changes since revision 1.57.2.5: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.93.2.4: download - view: text, markup, annotated - select for diffs
Sun Aug 29 16:33:30 1999 UTC (12 years, 5 months ago) by peter
Branches: RELENG_3
CVS tags: RELENG_3_5_0_RELEASE, RELENG_3_4_0_RELEASE, RELENG_3_3_0_RELEASE
Diff to: previous 1.93.2.3: preferred, colored; branchpoint 1.93: preferred, colored; next MAIN 1.94: preferred, colored
Changes since revision 1.93.2.3: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.105: download - view: text, markup, annotated - select for diffs
Sat Aug 28 00:52:36 1999 UTC (12 years, 5 months ago) by peter
Branches: MAIN
Diff to: previous 1.104: preferred, colored
Changes since revision 1.104: +1 -1 lines
$Id$ -> $FreeBSD$

Revision 1.104: download - view: text, markup, annotated - select for diffs
Sun Aug 1 06:05:07 1999 UTC (12 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.103: preferred, colored
Changes since revision 1.103: +4 -3 lines
Move the memory access behavior information provided by madvise
from the vm_object to the vm_map.

Submitted by:	dillon

Revision 1.103: download - view: text, markup, annotated - select for diffs
Tue Jul 20 05:46:56 1999 UTC (12 years, 6 months ago) by alc
Branches: MAIN
Diff to: previous 1.102: preferred, colored
Changes since revision 1.102: +3 -7 lines
Convert a "page not busy" warning to an assertion.

Submitted by:	dillon@backplane.com

Revision 1.102: download - view: text, markup, annotated - select for diffs
Sun May 2 23:57:11 1999 UTC (12 years, 9 months ago) by alc
Branches: MAIN
CVS tags: POST_VFS_BIO_NFS_PATCH
Diff to: previous 1.101: preferred, colored
Changes since revision 1.101: +25 -5 lines
The VFS/BIO subsystem contained a number of hacks in order to optimize
piecemeal, middle-of-file writes for NFS.  These hacks have caused no
end of trouble, especially when combined with mmap().  I've removed
them.  Instead, NFS will issue a read-before-write to fully
instantiate the struct buf containing the write.  NFS does, however,
optimize piecemeal appends to files.  For most common file operations,
you will not notice the difference.  The sole remaining fragment in
the VFS/BIO system is b_dirtyoff/end, which NFS uses to avoid cache
coherency issues with read-merge-write style operations.  NFS also
optimizes the write-covers-entire-buffer case by avoiding the
read-before-write.  There is quite a bit of room for further
optimization in these areas.

The VM system marks pages fully-valid (AKA vm_page_t->valid =
VM_PAGE_BITS_ALL) in several places, most noteably in vm_fault.  This
is not correct operation.  The vm_pager_get_pages() code is now
responsible for marking VM pages all-valid.  A number of VM helper
routines have been added to aid in zeroing-out the invalid portions of
a VM page prior to the page being marked all-valid.  This operation is
necessary to properly support mmap().  The zeroing occurs most often
when dealing with file-EOF situations.  Several bugs have been fixed
in the NFS subsystem, including bits handling file and directory EOF
situations and buf->b_flags consistancy issues relating to clearing
B_ERROR & B_INVAL, and handling B_DONE.

getblk() and allocbuf() have been rewritten.  B_CACHE operation is now
formally defined in comments and more straightforward in
implementation.  B_CACHE for VMIO buffers is based on the validity of
the backing store.  B_CACHE for non-VMIO buffers is based simply on
whether the buffer is B_INVAL or not (B_CACHE set if B_INVAL clear,
and vise-versa).  biodone() is now responsible for setting B_CACHE
when a successful read completes.  B_CACHE is also set when a bdwrite()
is initiated and when a bwrite() is initiated.  VFS VOP_BWRITE
routines (there are only two - nfs_bwrite() and bwrite()) are now
expected to set B_CACHE.  This means that bowrite() and bawrite() also
set B_CACHE indirectly.

There are a number of places in the code which were previously using
buf->b_bufsize (which is DEV_BSIZE aligned) when they should have
been using buf->b_bcount.  These have been fixed.  getblk() now clears
B_DONE on return because the rest of the system is so bad about
dealing with B_DONE.

Major fixes to NFS/TCP have been made.  A server-side bug could cause
requests to be lost by the server due to nfs_realign() overwriting
other rpc's in the same TCP mbuf chain.  The server's kernel must be
recompiled to get the benefit of the fixes.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>

Revision 1.93.2.3: download - view: text, markup, annotated - select for diffs
Tue Mar 23 04:12:49 1999 UTC (12 years, 10 months ago) by alc
Branches: RELENG_3
CVS tags: RELENG_3_2_PAO_BP, RELENG_3_2_PAO, RELENG_3_2_0_RELEASE
Diff to: previous 1.93.2.2: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.2: +3 -2 lines
MFC: 1.101

Revision 1.101: download - view: text, markup, annotated - select for diffs
Thu Feb 25 06:00:52 1999 UTC (12 years, 11 months ago) by alc
Branches: MAIN
CVS tags: PRE_VFS_BIO_NFS_PATCH, PRE_SMP_VMSHARE, PRE_NEWBUS, POST_SMP_VMSHARE, POST_NEWBUS
Diff to: previous 1.100: preferred, colored
Changes since revision 1.100: +3 -2 lines
Reviewed by:	Matthew Dillon <dillon@apollo.backplane.com>
Corrected the computation of cnt.v_ozfod in vm_fault: vm_fault
was counting the number of unoptimized rather than optimized
zero-fill faults.

Revision 1.93.2.2: download - view: text, markup, annotated - select for diffs
Thu Feb 18 02:04:01 1999 UTC (12 years, 11 months ago) by dillon
Branches: RELENG_3
Diff to: previous 1.93.2.1: preferred, colored; branchpoint 1.93: preferred, colored
Changes since revision 1.93.2.1: +13 -1 lines
    Backport from -4.x, unlock vnode before map lookup to avoid deadlock
    situation between the vnode and map locks.

Revision 1.100: download - view: text, markup, annotated - select for diffs
Wed Feb 17 09:08:29 1999 UTC (12 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.99: preferred, colored
Changes since revision 1.99: +12 -1 lines
Submitted by:	Luoqi Chen <luoqi@watermarkgroup.com>

    Unlock vnode before messing with map to avoid deadlock between map and
    vnode ( e.g. with exec_map and underlying program binary vnode ).  Solves
    a deadlock that most often occurs during a large -j# buildworld reported
    by three people.

Revision 1.99: download - view: text, markup, annotated - select for diffs
Sun Feb 7 21:48:21 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.98: preferred, colored
Changes since revision 1.98: +3 -4 lines
    Remove MAP_ENTRY_IS_A_MAP 'share' maps.  These maps were once used to
    attempt to optimize forks but were essentially given-up on due to
    problems and replaced with an explicit dup of the vm_map_entry structure.
    Prior to the removal, they were entirely unused.

Revision 1.98: download - view: text, markup, annotated - select for diffs
Sun Jan 24 06:04:52 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.97: preferred, colored
Changes since revision 1.97: +2 -2 lines
    Change all manual settings of vm_page_t->dirty = VM_PAGE_BITS_ALL
    to use the vm_page_dirty() inline.

    The inline can thus do sanity checks ( or not ) over all cases.

Revision 1.97: download - view: text, markup, annotated - select for diffs
Sun Jan 24 00:55:04 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.96: preferred, colored
Changes since revision 1.96: +13 -4 lines
    Get rid of unused old_m in vm_fault.  Add INVARIANTS to test whether
    page is still busy after all the hell vm_fault goes through.. it is
    supposed to be, and printf() if it isn't.  don't panic, though.

Revision 1.96: download - view: text, markup, annotated - select for diffs
Sat Jan 23 06:00:27 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.95: preferred, colored
Changes since revision 1.95: +13 -7 lines
    Reenable John Dyson's low-memory VM_WAIT code for page reactivations out
    of PQ_CACHE.  Add comments explaining what it accomplishes and its
    limitations.

Revision 1.93.2.1: download - view: text, markup, annotated - select for diffs
Fri Jan 22 05:49:39 1999 UTC (13 years ago) by dillon
Branches: RELENG_3
CVS tags: RELENG_3_1_0_RELEASE
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +24 -9 lines
    Backport from -4.x.  We are supposed to wait while the page is busy before
    messing with it, but the VM code was special-casing a m->busy page that
    was still valid ( i.e. usually a pageout ) and allowing it through.  The
    problem is that whatever m->busy'd the page is probably still depending on
    it not being messed with.  Specifically, I am thinking of the
    vm_pager_get_pages() code where the OBJT_VNODE pager converts PG_BUSY
    to m->busy for the read operation.    While this code may not be
    specifically broken for the case, it does initially set PG_BUSY and assume
    that it has the entire page to itself... but OBJT_VNODE converts it to
    m->busy.  It is just too dangerous to allow the special case optimization
    through.

    Removing the special optimization should have no discernable effect since
    pageout operates mark resident pmap pte's READ-ONLY rather then unmapping
    them, and so no fault normally occurs.

Revision 1.95: download - view: text, markup, annotated - select for diffs
Thu Jan 21 09:35:38 1999 UTC (13 years ago) by dillon
Branches: MAIN
Diff to: previous 1.94: preferred, colored
Changes since revision 1.94: +1 -1 lines
    Mainly cleanup.  Removed some inappropriate low-memory handling code
    and added lots of comments.  Add tie-in to vm_pager ( and thus the
    new swapper ) to deallocate backing swap for dirtied pages on the fly.

Revision 1.94: download - view: text, markup, annotated - select for diffs
Thu Jan 21 08:29:10 1999 UTC (13 years ago) by dillon
Branches: MAIN
CVS tags: POST_MATT_SWAPPER
Diff to: previous 1.93: preferred, colored
Changes since revision 1.93: +84 -37 lines
    This is a rather large commit that encompasses the new swapper,
    changes to the VM system to support the new swapper, VM bug
    fixes, several VM optimizations, and some additional revamping of the
    VM code.  The specific bug fixes will be documented with additional
    forced commits.  This commit is somewhat rough in regards to code
    cleanup issues.

Reviewed by:	"John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com>

Revision 1.93: download - view: text, markup, annotated - select for diffs
Sun Jan 10 01:58:28 1999 UTC (13 years, 1 month ago) by eivind
Branches: MAIN
CVS tags: RELENG_3_BP, PRE_MATT_SWAPPER
Branch point for: RELENG_3
Diff to: previous 1.92: preferred, colored
Changes since revision 1.92: +1 -2 lines
KNFize, by bde.

Revision 1.92: download - view: text, markup, annotated - select for diffs
Fri Jan 8 17:31:24 1999 UTC (13 years, 1 month ago) by eivind
Branches: MAIN
Diff to: previous 1.91: preferred, colored
Changes since revision 1.91: +3 -5 lines
Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT as
discussed on -hackers.

Introduce 'KASSERT(assertion, ("panic message", args))' for simple
check + panic.

Reviewed by:	msmith

Revision 1.57.2.5: download - view: text, markup, annotated - select for diffs
Wed Nov 25 07:45:00 1998 UTC (13 years, 2 months ago) by dg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_8_RELEASE
Diff to: previous 1.57.2.4: preferred, colored; branchpoint 1.57: preferred, colored
Changes since revision 1.57.2.4: +4 -4 lines
Brought in fix from rev 1.91: splvm protect unqueue call.

Revision 1.91: download - view: text, markup, annotated - select for diffs
Wed Nov 25 07:40:49 1998 UTC (13 years, 2 months ago) by dg
Branches: MAIN
Diff to: previous 1.90: preferred, colored
Changes since revision 1.90: +4 -4 lines
Add missing splvm protection around unqueue call. Without this, the page
queues would eventually get corrupted.

Revision 1.90: download - view: text, markup, annotated - select for diffs
Wed Oct 28 13:37:02 1998 UTC (13 years, 3 months ago) by dg
Branches: MAIN
Diff to: previous 1.89: preferred, colored
Changes since revision 1.89: +3 -3 lines
Added a second argument, "activate" to the vm_page_unwire() call so that
the caller can select either inactive or active queue to put the page on.

Revision 1.89: download - view: text, markup, annotated - select for diffs
Sun Oct 25 17:44:58 1998 UTC (13 years, 3 months ago) by phk
Branches: MAIN
Diff to: previous 1.88: preferred, colored
Changes since revision 1.88: +1 -2 lines
Nitpicking and dusting performed on a train.  Removes trivial warnings
about unused variables, labels and other lint.

Revision 1.57.2.4: download - view: text, markup, annotated - select for diffs
Tue Sep 22 01:30:54 1998 UTC (13 years, 4 months ago) by jdp
Branches: RELENG_2_2
Diff to: previous 1.57.2.3: preferred, colored; branchpoint 1.57: preferred, colored
Changes since revision 1.57.2.3: +11 -9 lines
Merge in the fix for the "GDB touches executables" problem.  The
following revisions are included in this merge:

  1.89      src/sys/i386/i386/trap.c
  1.24,1.25 src/sys/miscfs/procfs/procfs_mem.c
  1.32      src/sys/vm/vm_extern.h
  1.67      src/sys/vm/vm_fault.c
  1.73      src/sys/vm/vm_map.c
  1.25      src/sys/vm/vm_map.h
  1.8       src/sys/vm/vm_prot.h

PR:		kern/3475, kern/7858

Revision 1.88: download - view: text, markup, annotated - select for diffs
Fri Sep 4 08:06:57 1998 UTC (13 years, 5 months ago) by dfr
Branches: MAIN
CVS tags: RELENG_3_0_0_RELEASE
Diff to: previous 1.87: preferred, colored
Changes since revision 1.87: +12 -12 lines
Cosmetic changes to the PAGE_XXX macros to make them consistent with
the other objects in vm.

Revision 1.87: download - view: text, markup, annotated - select for diffs
Mon Aug 24 08:39:37 1998 UTC (13 years, 5 months ago) by dfr
Branches: MAIN
Diff to: previous 1.86: preferred, colored
Changes since revision 1.86: +11 -10 lines
Change various syscalls to use size_t arguments instead of u_int.

Add some overflow checks to read/write (from bde).

Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags
and vm_object::paging_in_progress to use operations which are not
interruptable.

Reviewed by: Bruce Evans <bde@zeta.org.au>

Revision 1.86: download - view: text, markup, annotated - select for diffs
Thu Aug 6 08:33:19 1998 UTC (13 years, 6 months ago) by dfr
Branches: MAIN
Diff to: previous 1.85: preferred, colored
Changes since revision 1.85: +3 -3 lines
Protect all modifications to paging_in_progress with splvm().  The i386
managed to avoid corruption of this variable by luck (the compiler used a
memory read-modify-write instruction which wasn't interruptable) but other
architectures cannot.

With this change, I am now able to 'make buildworld' on the alpha (sfx: the
crowd goes wild...)

Revision 1.85: download - view: text, markup, annotated - select for diffs
Wed Jul 22 09:38:04 1998 UTC (13 years, 6 months ago) by dg
Branches: MAIN
Diff to: previous 1.84: preferred, colored
Changes since revision 1.84: +3 -3 lines
Improved pager input failure message.

Revision 1.84: download - view: text, markup, annotated - select for diffs
Sat Jul 11 12:07:52 1998 UTC (13 years, 7 months ago) by bde
Branches: MAIN
Diff to: previous 1.83: preferred, colored
Changes since revision 1.83: +2 -2 lines
Fixed printf format errors.

Revision 1.83: download - view: text, markup, annotated - select for diffs
Mon May 4 03:01:43 1998 UTC (13 years, 9 months ago) by dyson
Branches: MAIN
CVS tags: PRE_NOBDEV
Diff to: previous 1.82: preferred, colored
Changes since revision 1.82: +3 -2 lines
Work around some VM bugs, the worst being an overly aggressive
swap space free calculation.  More complete fixes will be forthcoming,
in a week.

Revision 1.82: download - view: text, markup, annotated - select for diffs
Sat Mar 7 20:45:47 1998 UTC (13 years, 11 months ago) by dyson
Branches: MAIN
CVS tags: PRE_SOFTUPDATE, PRE_DEVFS_SLICE, POST_SOFTUPDATE, POST_DEVFS_SLICE
Diff to: previous 1.81: preferred, colored
Changes since revision 1.81: +209 -221 lines
Make vm_fault much cleaner by removing the evil macro inlines, and
put alot of it's context into a data structure.  This allows
significant shortening of its codepath, and will significantly
decrease it's cache footprint.

Also, add some stats to vmmeter.  Note that you'll have to
rebuild/recompile vmstat, systat, etc... Otherwise, you'll
get "very interesting" paging stats.

Revision 1.81: download - view: text, markup, annotated - select for diffs
Sun Mar 1 04:18:18 1998 UTC (13 years, 11 months ago) by dyson
Branches: MAIN
Diff to: previous 1.80: preferred, colored
Changes since revision 1.80: +7 -6 lines
1)	Use a more consistent page wait methodology.
2)	Do not unnecessarily force page blocking when paging
	pages out.
3)	Further improve swap pager performance and correctness,
	including fixing the paging in progress deadlock (except
	in severe I/O error conditions.)
4)	Enable vfs_ioopt=1 as a default.
5)	Fix and enable the page prezeroing in SMP mode.

All in all, SMP systems especially should show a significant
improvement in "snappyness."

Revision 1.80: download - view: text, markup, annotated - select for diffs
Mon Feb 9 06:11:23 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.79: preferred, colored
Changes since revision 1.79: +4 -3 lines
Staticize.

Revision 1.79: download - view: text, markup, annotated - select for diffs
Fri Feb 6 12:14:22 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.78: preferred, colored
Changes since revision 1.78: +1 -3 lines
Back out DIAGNOSTIC changes.

Revision 1.78: download - view: text, markup, annotated - select for diffs
Wed Feb 4 22:33:43 1998 UTC (14 years ago) by eivind
Branches: MAIN
Diff to: previous 1.77: preferred, colored
Changes since revision 1.77: +3 -1 lines
Turn DIAGNOSTIC into a new-style option.

Revision 1.77: download - view: text, markup, annotated - select for diffs
Sat Jan 31 11:56:32 1998 UTC (14 years ago) by dyson
Branches: MAIN
Diff to: previous 1.76: preferred, colored
Changes since revision 1.76: +5 -14 lines
Change the busy page mgmt, so that when pages are freed, they
MUST be PG_BUSY.  It is bogus to free a page that isn't busy,
because it is in a state of being "unavailable" when being
freed.  The additional advantage is that the page_remove code
has a better cross-check that the page should be busy and
unavailable for other use.  There were some minor problems
with the collapse code, and this plugs those subtile "holes."

Also, the vfs_bio code wasn't checking correctly for PG_BUSY
pages.  I am going to develop a more consistant scheme for
grabbing pages, busy or otherwise.  For now, we are stuck
with the current morass.

Revision 1.76: download - view: text, markup, annotated - select for diffs
Thu Jan 22 17:30:33 1998 UTC (14 years ago) by dyson
Branches: MAIN
Diff to: previous 1.75: preferred, colored
Changes since revision 1.75: +89 -170 lines
VM level code cleanups.

1)	Start using TSM.
	Struct procs continue to point to upages structure, after being freed.
	Struct vmspace continues to point to pte object and kva space for kstack.
	u_map is now superfluous.
2)	vm_map's don't need to be reference counted.  They always exist either
	in the kernel or in a vmspace.  The vmspaces are managed by reference
	counts.
3)	Remove the "wired" vm_map nonsense.
4)	No need to keep a cache of kernel stack kva's.
5)	Get rid of strange looking ++var, and change to var++.
6)	Change more data structures to use our "zone" allocator.  Added
	struct proc, struct vmspace and struct vnode.  This saves a significant
	amount of kva space and physical memory.  Additionally, this enables
	TSM for the zone managed memory.
7)	Keep ioopt disabled for now.
8)	Remove the now bogus "single use" map concept.
9)	Use generation counts or id's for data structures residing in TSM, where
	it allows us to avoid unneeded restart overhead during traversals, where
	blocking might occur.
10)	Account better for memory deficits, so the pageout daemon will be able
	to make enough memory available (experimental.)
11)	Fix some vnode locking problems. (From Tor, I think.)
12)	Add a check in ufs_lookup, to avoid lots of unneeded calls to bcmp.
	(experimental.)
13)	Significantly shrink, cleanup, and make slightly faster the vm_fault.c
	code.  Use generation counts, get rid of unneded collpase operations,
	and clean up the cluster code.
14)	Make vm_zone more suitable for TSM.

This commit is partially as a result of discussions and contributions from
other people, including DG, Tor Egge, PHK, and probably others that I
have forgotten to attribute (so let me know, if I forgot.)

This is not the infamous, final cleanup of the vnode stuff, but a necessary
step.  Vnode mgmt should be correct, but things might still change, and
there is still some missing stuff (like ioopt, and physical backing of
non-merged cache files, debugging of layering concepts.)

Revision 1.75: download - view: text, markup, annotated - select for diffs
Sat Jan 17 09:16:49 1998 UTC (14 years ago) by dyson
Branches: MAIN
Diff to: previous 1.74: preferred, colored
Changes since revision 1.74: +52 -40 lines
Tie up some loose ends in vnode/object management.  Remove an unneeded
config option in pmap.  Fix a problem with faulting in pages.  Clean-up
some loose ends in swap pager memory management.

The system should be much more stable, but all subtile bugs aren't fixed yet.

Revision 1.74: download - view: text, markup, annotated - select for diffs
Mon Jan 12 01:44:25 1998 UTC (14 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.73: preferred, colored
Changes since revision 1.73: +3 -1 lines
Fix some vnode management problems, and better mgmt of vnode free list.
Fix the UIO optimization code.
Fix an assumption in vm_map_insert regarding allocation of swap pagers.
Fix an spl problem in the collapse handling in vm_object_deallocate.
When pages are freed from vnode objects, and the criteria for putting
the associated vnode onto the free list is reached, either put the
vnode onto the list, or put it onto an interrupt safe version of the
list, for further transfer onto the actual free list.
Some minor syntax changes changing pre-decs, pre-incs to post versions.
Remove a bogus timeout (that I added for debugging) from vn_lock.

PHK will likely still have problems with the vnode list management, and
so do I, but it is better than it was.

Revision 1.73: download - view: text, markup, annotated - select for diffs
Tue Jan 6 05:25:54 1998 UTC (14 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.72: preferred, colored
Changes since revision 1.72: +10 -11 lines
Make our v_usecount vnode reference count work identically to the
original BSD code.  The association between the vnode and the vm_object
no longer includes reference counts.  The major difference is that
vm_object's are no longer freed gratuitiously from the vnode, and so
once an object is created for the vnode, it will last as long as the
vnode does.

When a vnode object reference count is incremented, then the underlying
vnode reference count is incremented also.  The two "objects" are now
more intimately related, and so the interactions are now much less
complex.

When vnodes are now normally placed onto the free queue with an object still
attached.  The rundown of the object happens at vnode rundown time, and
happens with exactly the same filesystem semantics of the original VFS
code.  There is absolutely no need for vnode_pager_uncache and other
travesties like that anymore.

A side-effect of these changes is that SMP locking should be much simpler,
the I/O copyin/copyout optimizations work, NFS should be more ponderable,
and further work on layered filesystems should be less frustrating, because
of the totally coherent management of the vnode objects and vnodes.

Please be careful with your system while running this code, but I would
greatly appreciate feedback as soon a reasonably possible.

Revision 1.72: download - view: text, markup, annotated - select for diffs
Fri Dec 19 09:03:10 1997 UTC (14 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.71: preferred, colored
Changes since revision 1.71: +7 -2 lines
Some performance improvements, and code cleanups (including changing our
expensive OFF_TO_IDX to btoc whenever possible.)

Revision 1.71: download - view: text, markup, annotated - select for diffs
Mon Sep 1 03:17:15 1997 UTC (14 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.70: preferred, colored
Changes since revision 1.70: +1 -5 lines
Removed unused #includes.

Revision 1.70: download - view: text, markup, annotated - select for diffs
Mon Aug 25 22:15:19 1997 UTC (14 years, 5 months ago) by bde
Branches: MAIN
Diff to: previous 1.69: preferred, colored
Changes since revision 1.69: +2 -6 lines
Fixed type mismatches for functions with args of type vm_prot_t and/or
vm_inherit_t.  These types are smaller than ints, so the prototypes
should have used the promoted type (int) to match the old-style function
definitions.  They use just vm_prot_t and/or vm_inherit_t.  This depends
on gcc features to work.  I fixed the definitions since this is easiest.
The correct fix may be to change the small types to u_int, to optimize
for time instead of space.

Revision 1.57.2.3: download - view: text, markup, annotated - select for diffs
Wed May 28 18:26:46 1997 UTC (14 years, 8 months ago) by dfr
Branches: RELENG_2_2
CVS tags: RELENG_2_2_7_RELEASE, RELENG_2_2_6_RELEASE, RELENG_2_2_5_RELEASE
Diff to: previous 1.57.2.2: preferred, colored; branchpoint 1.57: preferred, colored
Changes since revision 1.57.2.2: +2 -2 lines
YAMFC (NFS mmap fixes and minor memory leak plugged)

Reviewed by:	Randy Terbush <randy@zyzzyva.com>

Revision 1.69: download - view: text, markup, annotated - select for diffs
Mon May 19 14:36:54 1997 UTC (14 years, 8 months ago) by dfr
Branches: MAIN
CVS tags: WOLLMAN_MBUF, BP_WOLLMAN_MBUF
Diff to: previous 1.68: preferred, colored
Changes since revision 1.68: +2 -2 lines
Fix a few bugs with NFS and mmap caused by NFS' use of b_validoff
and b_validend.  The changes to vfs_bio.c are a bit ugly but hopefully
can be tidied up later by a slight redesign.

PR:		kern/2573, kern/2754, kern/3046 (possibly)
Reviewed by:	dyson

Revision 1.68: download - view: text, markup, annotated - select for diffs
Sun Apr 6 16:16:11 1997 UTC (14 years, 10 months ago) by peter
Branches: MAIN
CVS tags: pre_smp_merge, post_smp_merge
Diff to: previous 1.67: preferred, colored
Changes since revision 1.67: +2 -2 lines
Commit a typo fix that's been sitting in my tree for ages, quite forgotten.
The typo was detected once apon a time with the -Wunused compile option.
The result was that a block of code for implementing
madvise(.. MADV_SEQUENTIAL..) behavior was "dead" and unused, probably
negating the effect of activating the option.

Reviewed by: dyson

Revision 1.67: download - view: text, markup, annotated - select for diffs
Sun Apr 6 02:29:41 1997 UTC (14 years, 10 months ago) by dyson
Branches: MAIN
Diff to: previous 1.66: preferred, colored
Changes since revision 1.66: +11 -9 lines
Fix the gdb executable modify problem.  Thanks to the detective work
by Alan Cox <alc@cs.rice.edu>, and his description of the problem.

The bug was primarily in procfs_mem, but the mistake likely happened
due to the lack of vm system support for the operation.  I added
better support for selective marking of page dirty flags so that
vm_map_pageable(wiring) will not cause this problem again.

The code in procfs_mem is now less bogus (but maybe still a little
so.)

Revision 1.57.2.2: download - view: text, markup, annotated - select for diffs
Tue Mar 25 04:54:23 1997 UTC (14 years, 10 months ago) by dyson
Branches: RELENG_2_2
CVS tags: RELENG_2_2_2_RELEASE, RELENG_2_2_1_RELEASE
Diff to: previous 1.57.2.1: preferred, colored; branchpoint 1.57: preferred, colored
Changes since revision 1.57.2.1: +70 -3 lines
1.  Fix the vm_page_zero_count accounting.  This should improve the
    performance of the pre-zero loop.
2.  Fix madvise.  It had a myriad of bugs, including the potential
    for system crashes.
3.  Improve vm_map handling.  This is a result of work done by both
    <alc@cs.rice.edu> (Alan Cox) and me.  Earlier versions of the
    map handling code was very unintelligent about map coalescing.
4.  Support a working and closer to POSIX mlock.
5.  A couple of performance enhancements that came along for the ride,
    including changing certain bitfields to flags in vm_map.
6.  Bring procfs up to date with respect to the changes.

This code has been carefully extracted from -current.

Reviewed by:	David Greenman <dg@freebsd.org>

Revision 1.66: download - view: text, markup, annotated - select for diffs
Sat Feb 22 09:48:15 1997 UTC (14 years, 11 months ago) by peter
Branches: MAIN
Diff to: previous 1.65: preferred, colored
Changes since revision 1.65: +1 -1 lines
Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$.  We are not
ready for it yet.

Revision 1.65: download - view: text, markup, annotated - select for diffs
Mon Feb 10 02:22:15 1997 UTC (15 years ago) by dyson
Branches: MAIN
Diff to: previous 1.64: preferred, colored
Changes since revision 1.64: +3 -2 lines
This is the kernel Lite/2 commit.  There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>

Revision 1.64: download - view: text, markup, annotated - select for diffs
Thu Jan 16 04:15:57 1997 UTC (15 years ago) by dyson
Branches: MAIN
Diff to: previous 1.63: preferred, colored
Changes since revision 1.63: +2 -2 lines
Change the map entry flags from bitfields to bitmasks.  Allows
for some code simplification.

Revision 1.63: download - view: text, markup, annotated - select for diffs
Tue Jan 14 06:57:24 1997 UTC (15 years ago) by jkh
Branches: MAIN
Diff to: previous 1.62: preferred, colored
Changes since revision 1.62: +1 -1 lines
Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.

Revision 1.62: download - view: text, markup, annotated - select for diffs
Fri Jan 3 17:02:25 1997 UTC (15 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.61: preferred, colored
Changes since revision 1.61: +1 -3 lines
Undo the collapse breakage (swap space usage problem.)

Revision 1.61: download - view: text, markup, annotated - select for diffs
Wed Jan 1 04:45:02 1997 UTC (15 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.60: preferred, colored
Changes since revision 1.60: +3 -1 lines
Guess what?  We left alot of the old collapse code that is not needed
anymore with the "full" collapse fix that we added about 1yr ago!!!  The
code has been removed by optioning it out for now, so we can put it back
in ASAP if any problems are found.

Revision 1.60: download - view: text, markup, annotated - select for diffs
Sun Dec 29 02:33:12 1996 UTC (15 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.59: preferred, colored
Changes since revision 1.59: +2 -2 lines
Superficial cleanup of comment.

Revision 1.57.2.1: download - view: text, markup, annotated - select for diffs
Sun Dec 15 09:57:11 1996 UTC (15 years, 1 month ago) by davidg
Branches: RELENG_2_2
CVS tags: RELENG_2_2_0_RELEASE
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +8 -9 lines
Merge from -current: vm_map_entry leak fix, John's vm_map coallesce fixes,
and changes for dynamically-sized buffers.

Revision 1.59: download - view: text, markup, annotated - select for diffs
Sat Dec 14 17:54:13 1996 UTC (15 years, 1 month ago) by dyson
Branches: MAIN
Diff to: previous 1.58: preferred, colored
Changes since revision 1.58: +69 -2 lines
Implement closer-to POSIX mlock semantics.  The major difference is
that we do allow mlock to span unallocated regions (of course, not
mlocking them.)  We also allow mlocking of RO regions (which the old
code couldn't.)  The restriction there is that once a RO region is
wired (mlocked), it cannot be debugged (or EVER written to.)

Under normal usage, the new mlock code will be a significant improvement
over our old stuff.

Revision 1.58: download - view: text, markup, annotated - select for diffs
Sat Nov 30 22:41:46 1996 UTC (15 years, 2 months ago) by dyson
Branches: MAIN
Diff to: previous 1.57: preferred, colored
Changes since revision 1.57: +7 -8 lines
Implement a new totally dynamic (up to MAXPHYS) buffer kva allocation
scheme.  Additionally, add the capability for checking for unexpected
kernel page faults.  The maximum amount of kva space for buffers hasn't
been decreased from where it is, but it will now be possible to do so.

This scheme manages the kva space similar to the buffers themselves.  If
there isn't enough kva space because of usage or fragementation, buffers
will be reclaimed until a buffer allocation is successful.  This scheme
should be very resistant to fragmentation problems until/if the LFS code
is fixed and uses the bogus buffer locking scheme -- but a 'fixed' LFS
is not likely to use such a scheme.

Now there should be NO problem allocating buffers up to MAXPHYS.

Revision 1.57: download - view: text, markup, annotated - select for diffs
Sun Sep 8 20:44:37 1996 UTC (15 years, 5 months ago) by dyson
Branches: MAIN
CVS tags: RELENG_2_2_BP
Branch point for: RELENG_2_2
Diff to: previous 1.56: preferred, colored
Changes since revision 1.56: +2 -2 lines
Addition of page coloring support.  Various levels of coloring are afforded.
The default level works with minimal overhead, but one can also enable
full, efficient use of a 512K cache.  (Parameters can be generated
to support arbitrary cache sizes also.)

Revision 1.56: download - view: text, markup, annotated - select for diffs
Tue Jul 30 03:08:07 1996 UTC (15 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.55: preferred, colored
Changes since revision 1.55: +13 -6 lines
Backed out the recent changes/enhancements to the VM code.  The
problem with the 'shell scripts' was found, but there was a 'strange'
problem found with a 486 laptop that we could not find.  This commit
backs the code back to 25-jul, and will be re-entered after the snapshot
in smaller (more easily tested) chunks.

Revision 1.55: download - view: text, markup, annotated - select for diffs
Sun Jul 28 01:14:01 1996 UTC (15 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.54: preferred, colored
Changes since revision 1.54: +15 -29 lines
Undo part of the scalability commit.  Many of the changes
in vm_fault had some performance enhancements not ready
for prime time.  This commit backs out some of the changes.

Revision 1.54: download - view: text, markup, annotated - select for diffs
Sat Jul 27 03:23:52 1996 UTC (15 years, 6 months ago) by dyson
Branches: MAIN
Diff to: previous 1.53: preferred, colored
Changes since revision 1.53: +34 -27 lines
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.

Revision 1.25.4.4: download - view: text, markup, annotated - select for diffs
Tue Jul 2 10:59:04 1996 UTC (15 years, 7 months ago) by davidg
Branches: RELENG_2_1_0
CVS tags: RELENG_2_1_7_RELEASE, RELENG_2_1_6_RELEASE, RELENG_2_1_6_1_RELEASE, RELENG_2_1_5_RELEASE
Diff to: previous 1.25.4.3: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.3: +1 -6 lines
From main branch: Kill a bogus VM_WAIT in vm_fault_wire() that may have
undesired effects.

Submitted by:	dyson

Revision 1.53: download - view: text, markup, annotated - select for diffs
Tue Jul 2 02:07:59 1996 UTC (15 years, 7 months ago) by dyson
Branches: MAIN
Diff to: previous 1.52: preferred, colored
Changes since revision 1.52: +2 -2 lines
Properly set the PG_MAPPED and PG_WRITEABLE flags.  This fixes some potential
problems with vm_map_remove/vm_map_delete.

Revision 1.25.4.3: download - view: text, markup, annotated - select for diffs
Wed Jun 19 07:20:21 1996 UTC (15 years, 7 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.2: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.2: +7 -2 lines
Make certain that pages (especially cached pages) are pulled off the
page queue immediately so that they aren't used by something else before
we get to them.

Submitted by:	dyson

Revision 1.52: download - view: text, markup, annotated - select for diffs
Sun Jun 16 20:37:26 1996 UTC (15 years, 7 months ago) by dyson
Branches: MAIN
Diff to: previous 1.51: preferred, colored
Changes since revision 1.51: +19 -13 lines
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.

Revision 1.51: download - view: text, markup, annotated - select for diffs
Fri Jun 14 23:26:40 1996 UTC (15 years, 8 months ago) by davidg
Branches: MAIN
Diff to: previous 1.50: preferred, colored
Changes since revision 1.50: +2 -2 lines
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.

Revision 1.25.4.2: download - view: text, markup, annotated - select for diffs
Fri Jun 14 23:23:39 1996 UTC (15 years, 8 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.25.4.1: preferred, colored; branchpoint 1.25: preferred, colored
Changes since revision 1.25.4.1: +3 -3 lines
Brought in some fixes from main branch: similar to last commit...move
setting of PG_MAPPED (and in this case, PG_WRITEABLE too) to after
pmap_enter() has finished.

Revision 1.25.4.1: download - view: text, markup, annotated - select for diffs
Fri Jun 14 23:21:01 1996 UTC (15 years, 8 months ago) by davidg
Branches: RELENG_2_1_0
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +3 -3 lines
Brought in a fix from main branch: move setting of PG_MAPPED to after a
call to pmap_enter(). Closes a window where PG_MAPPED might be cleared
if the process blocked and someone else does a vm_page_protect(NONE)
before the process unblocks.

Reviewed by:	dyson

Revision 1.50: download - view: text, markup, annotated - select for diffs
Mon Jun 10 00:25:40 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.49: preferred, colored
Changes since revision 1.49: +7 -3 lines
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.

Revision 1.49: download - view: text, markup, annotated - select for diffs
Sat Jun 8 06:48:32 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.48: preferred, colored
Changes since revision 1.48: +4 -5 lines
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.

Revision 1.48: download - view: text, markup, annotated - select for diffs
Sat Jun 1 20:50:57 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.47: preferred, colored
Changes since revision 1.47: +9 -6 lines
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.

Revision 1.47: download - view: text, markup, annotated - select for diffs
Fri May 31 00:37:56 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.46: preferred, colored
Changes since revision 1.46: +12 -1 lines
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.

Revision 1.46: download - view: text, markup, annotated - select for diffs
Sun May 26 05:30:33 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.45: preferred, colored
Changes since revision 1.45: +3 -1 lines
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.

Revision 1.45: download - view: text, markup, annotated - select for diffs
Sun May 19 07:36:45 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.44: preferred, colored
Changes since revision 1.44: +43 -3 lines
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.

Revision 1.44: download - view: text, markup, annotated - select for diffs
Sat May 18 03:37:35 1996 UTC (15 years, 8 months ago) by dyson
Branches: MAIN
Diff to: previous 1.43: preferred, colored
Changes since revision 1.43: +12 -12 lines
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.

Revision 1.43: download - view: text, markup, annotated - select for diffs
Thu Mar 28 04:53:23 1996 UTC (15 years, 10 months ago) by dyson
Branches: MAIN
CVS tags: wollman_polling
Diff to: previous 1.42: preferred, colored
Changes since revision 1.42: +5 -5 lines
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.

Revision 1.1.1.2 (vendor branch): download - view: text, markup, annotated - select for diffs
Mon Mar 11 19:53:56 1996 UTC (15 years, 11 months ago) by peter
Branches: CSRG
CVS tags: bsd_44_lite_2
Diff to: previous 1.1.1.1: preferred, colored
Changes since revision 1.1.1.1: +5 -3 lines
Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all
files are off the vendor branch, so this should not change anything.

A "U" marker generally means that the file was not changed in between
the 4.4Lite and Lite-2 releases, and does not need a merge.  "C" generally
means that there was a change.

Revision 1.42: download - view: text, markup, annotated - select for diffs
Sat Mar 9 06:48:26 1996 UTC (15 years, 11 months ago) by dyson
Branches: MAIN
Diff to: previous 1.41: preferred, colored
Changes since revision 1.41: +3 -5 lines
Set the page valid bits in fewer places, as opposed to being scattered
in various places.

Revision 1.41: download - view: text, markup, annotated - select for diffs
Sat Mar 2 02:54:18 1996 UTC (15 years, 11 months ago) by dyson
Branches: MAIN
Diff to: previous 1.40: preferred, colored
Changes since revision 1.40: +128 -43 lines
1) Eliminate unnecessary bzero of UPAGES.
2) Eliminate unnecessary copying of pages during/after forks.
3) Add user map simplification.

Revision 1.40: download - view: text, markup, annotated - select for diffs
Fri Jan 19 03:59:43 1996 UTC (16 years ago) by dyson
Branches: MAIN
Diff to: previous 1.39: preferred, colored
Changes since revision 1.39: +9 -11 lines
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.

Revision 1.39: download - view: text, markup, annotated - select for diffs
Mon Dec 11 04:58:06 1995 UTC (16 years, 2 months ago) by dyson
Branches: MAIN
Diff to: previous 1.38: preferred, colored
Changes since revision 1.38: +49 -46 lines
Changes to support 1Tb filesizes.  Pages are now named by an
(object,index) pair instead of (object,offset) pair.

Revision 1.38: download - view: text, markup, annotated - select for diffs
Thu Dec 7 12:48:10 1995 UTC (16 years, 2 months ago) by davidg
Branches: MAIN
Diff to: previous 1.37: preferred, colored
Changes since revision 1.37: +9 -1 lines
Untangled the vm.h include file spaghetti.

Revision 1.37: download - view: text, markup, annotated - select for diffs
Mon Nov 20 12:19:53 1995 UTC (16 years, 2 months ago) by phk
Branches: MAIN
Diff to: previous 1.36: preferred, colored
Changes since revision 1.36: +1 -3 lines
Remove unused vars & funcs, make things static, protoize a little bit.

Revision 1.36: download - view: text, markup, annotated - select for diffs
Sun Nov 5 20:45:58 1995 UTC (16 years, 3 months ago) by dyson
Branches: MAIN
Diff to: previous 1.35: preferred, colored
Changes since revision 1.35: +2 -2 lines
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.)

Revision 1.35: download - view: text, markup, annotated - select for diffs
Thu Nov 2 06:42:47 1995 UTC (16 years, 3 months ago) by davidg
Branches: MAIN
Diff to: previous 1.34: preferred, colored
Changes since revision 1.34: +1 -4 lines
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>

Revision 1.34: download - view: text, markup, annotated - select for diffs
Mon Oct 23 03:49:28 1995 UTC (16 years, 3 months ago) by dyson
Branches: MAIN
Diff to: previous 1.33: preferred, colored
Changes since revision 1.33: +1 -9 lines
First phase of removing the PG_COPYONWRITE flag, and an architectural
cleanup of mapping files.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Sat Oct 7 19:02:53 1995 UTC (16 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.32: preferred, colored
Changes since revision 1.32: +2 -2 lines
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

Revision 1.32: download - view: text, markup, annotated - select for diffs
Sun Sep 24 19:47:58 1995 UTC (16 years, 4 months ago) by dyson
Branches: MAIN
Diff to: previous 1.31: preferred, colored
Changes since revision 1.31: +56 -114 lines
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.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Sep 14 13:42:52 1995 UTC (16 years, 5 months ago) by dyson
Branches: MAIN
Diff to: previous 1.30: preferred, colored
Changes since revision 1.30: +2 -2 lines
Fixed a typo in vm_fault_additional_pages.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Mon Sep 11 00:45:15 1995 UTC (16 years, 5 months ago) by dyson
Branches: MAIN
Diff to: previous 1.29: preferred, colored
Changes since revision 1.29: +29 -33 lines
Code cleanup and minor performance improvement in the faultin cluster
code.

Revision 1.29: download - view: text, markup, annotated - select for diffs
Wed Sep 6 05:37:39 1995 UTC (16 years, 5 months ago) by dyson
Branches: MAIN
Diff to: previous 1.28: preferred, colored
Changes since revision 1.28: +5 -4 lines
Minor performance improvements, additional prototype for additional
exported symbol.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Mon Sep 4 04:44:26 1995 UTC (16 years, 5 months ago) by dyson
Branches: MAIN
Diff to: previous 1.27: preferred, colored
Changes since revision 1.27: +25 -6 lines
Allow the fault code to use additional clustering info from both
bmap and the swap pager.  Improved fault clustering performance.

Revision 1.27: download - view: text, markup, annotated - select for diffs
Sun Sep 3 20:40:41 1995 UTC (16 years, 5 months ago) by dyson
Branches: MAIN
Diff to: previous 1.26: preferred, colored
Changes since revision 1.26: +6 -5 lines
Machine independent changes to support pre-zeroed free pages.  This
significantly improves demand-zero performance.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Thu Jul 13 08:48:20 1995 UTC (16 years, 7 months ago) by davidg
Branches: MAIN
Diff to: previous 1.25: preferred, colored
Changes since revision 1.25: +36 -254 lines
NOTE: libkvm, w, ps, 'top', and any other utility which depends on struct
      proc or any VM system structure will have to be rebuilt!!!

Much needed overhaul of the VM system. Included in this first round of
changes:

1) Improved pager interfaces: init, alloc, dealloc, getpages, putpages,
   haspage, and sync operations are supported. The haspage interface now
   provides information about clusterability. All pager routines now take
   struct vm_object's instead of "pagers".

2) Improved data structures. In the previous paradigm, there is constant
   confusion caused by pagers being both a data structure ("allocate a
   pager") and a collection of routines. The idea of a pager structure has
   escentially been eliminated. Objects now have types, and this type is
   used to index the appropriate pager. In most cases, items in the pager
   structure were duplicated in the object data structure and thus were
   unnecessary. In the few cases that remained, a un_pager structure union
   was created in the object to contain these items.

3) Because of the cleanup of #1 & #2, a lot of unnecessary layering can now
   be removed. For instance, vm_object_enter(), vm_object_lookup(),
   vm_object_remove(), and the associated object hash list were some of the
   things that were removed.

4) simple_lock's removed. Discussion with several people reveals that the
   SMP locking primitives used in the VM system aren't likely the mechanism
   that we'll be adopting. Even if it were, the locking that was in the code
   was very inadequate and would have to be mostly re-done anyway. The
   locking in a uni-processor kernel was a no-op but went a long way toward
   making the code difficult to read and debug.

5) Places that attempted to kludge-up the fact that we don't have kernel
   thread support have been fixed to reflect the reality that we are really
   dealing with processes, not threads. The VM system didn't have complete
   thread support, so the comments and mis-named routines were just wrong.
   We now use tsleep and wakeup directly in the lock routines, for instance.

6) Where appropriate, the pagers have been improved, especially in the
   pager_alloc routines. Most of the pager_allocs have been rewritten and
   are now faster and easier to maintain.

7) The pagedaemon pageout clustering algorithm has been rewritten and
   now tries harder to output an even number of pages before and after
   the requested page. This is sort of the reverse of the ideal pagein
   algorithm and should provide better overall performance.

8) Unnecessary (incorrect) casts to caddr_t in calls to tsleep & wakeup
   have been removed. Some other unnecessary casts have also been removed.

9) Some almost useless debugging code removed.

10) Terminology of shadow objects vs. backing objects straightened out.
    The fact that the vm_object data structure escentially had this
    backwards really confused things. The use of "shadow" and "backing
    object" throughout the code is now internally consistent and correct
    in the Mach terminology.

11) Several minor bug fixes, including one in the vm daemon that caused
    0 RSS objects to not get purged as intended.

12) A "default pager" has now been created which cleans up the transition
    of objects to the "swap" type. The previous checks throughout the code
    for swp->pg_data != NULL were really ugly. This change also provides
    the rudiments for future backing of "anonymous" memory by something
    other than the swap pager (via the vnode pager, for example), and it
    allows the decision about which of these pagers to use to be made
    dynamically (although will need some additional decision code to do
    this, of course).

13) (dyson) MAP_COPY has been deprecated and the corresponding "copy
    object" code has been removed. MAP_COPY was undocumented and non-
    standard. It was furthermore broken in several ways which caused its
    behavior to degrade to MAP_PRIVATE. Binaries that use MAP_COPY will
    continue to work correctly, but via the slightly different semantics
    of MAP_PRIVATE.

14) (dyson) Sharing maps have been removed. It's marginal usefulness in a
    threads design can be worked around in other ways. Both #12 and #13
    were done to simplify the code and improve readability and maintain-
    ability. (As were most all of these changes)

TODO:

1) Rewrite most of the vnode pager to use VOP_GETPAGES/PUTPAGES. Doing
   this will reduce the vnode pager to a mere fraction of its current size.

2) Rewrite vm_fault and the swap/vnode pagers to use the clustering
   information provided by the new haspage pager interface. This will
   substantially reduce the overhead by eliminating a large number of
   VOP_BMAP() calls. The VOP_BMAP() filesystem interface should be
   improved to provide both a "behind" and "ahead" indication of
   contiguousness.

3) Implement the extended features of pager_haspage in swap_pager_haspage().
   It currently just says 0 pages ahead/behind.

4) Re-implement the swap device (swstrategy) in a more elegant way, perhaps
   via a much more general mechanism that could also be used for disk
   striping of regular filesystems.

5) Do something to improve the architecture of vm_object_collapse(). The
   fact that it makes calls into the swap pager and knows too much about
   how the swap pager operates really bothers me. It also doesn't allow
   for collapsing of non-swap pager objects ("unnamed" objects backed by
   other pagers).

Revision 1.25: download - view: text, markup, annotated - select for diffs
Tue May 30 08:15:59 1995 UTC (16 years, 8 months ago) by rgrimes
Branches: MAIN
CVS tags: RELENG_2_1_0_RELEASE, RELENG_2_1_0_BP, RELENG_2_0_5_RELEASE, RELENG_2_0_5_BP, RELENG_2_0_5
Branch point for: RELENG_2_1_0
Diff to: previous 1.24: preferred, colored
Changes since revision 1.24: +13 -13 lines
Remove trailing whitespace.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Thu May 18 02:59:22 1995 UTC (16 years, 8 months ago) by davidg
Branches: MAIN
CVS tags: RELENG_2_0_5_ALPHA
Diff to: previous 1.23: preferred, colored
Changes since revision 1.23: +5 -1 lines
Accessing pages beyond the end of a mapped file results in internal
inconsistencies in the VM system that eventually lead to a panic. These
changes fix the behavior to conform to the behavior in SunOS, which is
to deny faults to pages beyond the EOF (returning SIGBUS). Internally,
this is implemented by requiring faults to be within the object size
boundaries. These changes exposed another bug, namely that passing in
an offset to mmap when trying to map an unnamed anonymous region also
results in internal inconsistencies. In this case, the offset is forced
to zero.

Reviewed by:	John Dyson and others

Revision 1.23: download - view: text, markup, annotated - select for diffs
Sun Apr 16 14:12:12 1995 UTC (16 years, 9 months ago) by davidg
Branches: MAIN
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +1 -2 lines
Removed obsolete/unused variable declarations. Killed externs and included
appropriate include files.

Revision 1.22: download - view: text, markup, annotated - select for diffs
Sun Apr 9 06:03:48 1995 UTC (16 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +20 -3 lines
Changes from John Dyson and myself:

Fixed remaining known bugs in the buffer IO and VM system.

vfs_bio.c:
Fixed some race conditions and locking bugs. Improved performance
by removing some (now) unnecessary code and fixing some broken
logic.
Fixed process accounting of # of FS outputs.
Properly handle NFS interrupts (B_EINTR).

(various)
Replaced calls to clrbuf() with calls to an optimized routine
called vfs_bio_clrbuf().

(various FS sync)
Sync out modified vnode_pager backed pages.

ffs_vnops.c:
Do two passes: Sync out file data first, then indirect blocks.

vm_fault.c:
Fixed deadly embrace caused by acquiring locks in the wrong order.

vnode_pager.c:
Changed to use buffer I/O system for writing out modified pages. This
should fix the problem with the modification date previous not getting
updated. Also dramatically simplifies the code. Note that this is
going to change in the future and be implemented via VOP_PUTPAGES().

vm_object.c:
Fixed a pile of bugs related to cleaning (vnode) objects. The performance
of vm_object_page_clean() is terrible when dealing with huge objects,
but this will change when we implement a binary tree to keep the object
pages sorted.

vm_pageout.c:
Fixed broken clustering of pageouts. Fixed race conditions and other
lockup style bugs in the scanning of pages. Improved performance.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Mon Mar 27 02:41:00 1995 UTC (16 years, 10 months ago) by davidg
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +11 -2 lines
Explicitly set page dirty if this is a write fault - reduces calls to
pmap_is_modified() later.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Mar 1 23:29:55 1995 UTC (16 years, 11 months ago) by davidg
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +30 -67 lines
Various changes from John and myself that do the following:

New functions create - vm_object_pip_wakeup and pagedaemon_wakeup that
are used to reduce the actual number of wakeups.
New function vm_page_protect which is used in conjuction with some new
page flags to reduce the number of calls to pmap_page_protect.
Minor changes to reduce unnecessary spl nesting.
Rewrote vm_page_alloc() to improve readability.
Various other mostly cosmetic changes.

Revision 1.19: download - view: text, markup, annotated - select for diffs
Wed Feb 22 09:15:26 1995 UTC (16 years, 11 months ago) by davidg
Branches: MAIN
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +25 -7 lines
Only do object paging_in_progress wakeups if someone is waiting on this
condition.

Submitted by:	John Dyson

Revision 1.18: download - view: text, markup, annotated - select for diffs
Thu Feb 2 09:08:17 1995 UTC (17 years ago) by davidg
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +6 -10 lines
swap_pager.c:
Fixed long standing bug in freeing swap space during object collapses.
Fixed 'out of space' messages from printing out too often.
Modified to use new kmem_malloc() calling convention.
Implemented an additional stat in the swap pager struct to count the
amount of space allocated to that pager. This may be removed at some
point in the future.
Minimized unnecessary wakeups.

vm_fault.c:
Don't try to collect fault stats on 'swapped' processes - there aren't
any upages to store the stats in.
Changed read-ahead policy (again!).

vm_glue.c:
Be sure to gain a reference to the process's map before swapping.
Be sure to lose it when done.

kern_malloc.c:
Added the ability to specify if allocations are at interrupt time or
are 'safe'; this affects what types of pages can be allocated.

vm_map.c:
Fixed a variety of map lock problems; there's still a lurking bug that
will eventually bite.

vm_object.c:
Explicitly initialize the object fields rather than bzeroing the struct.
Eliminated the 'rcollapse' code and folded it's functionality into the
"real" collapse routine.
Moved an object_unlock() so that the backing_object is protected in
the qcollapse routine.
Make sure nobody fools with the backing_object when we're destroying it.
Added some diagnostic code which can be called from the debugger that
looks through all the internal objects and makes certain that they
all belong to someone.

vm_page.c:
Fixed a rather serious logic bug that would result in random system
crashes. Changed pagedaemon wakeup policy (again!).

vm_pageout.c:
Removed unnecessary page rotations on the inactive queue.
Changed the number of pages to explicitly free to just free_reserved
level.

Submitted by:	John Dyson

Revision 1.17: download - view: text, markup, annotated - select for diffs
Thu Jan 26 01:40:04 1995 UTC (17 years ago) by davidg
Branches: MAIN
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +4 -4 lines
Use the VM_PAGE_BITS_ALL in a place it can be used.
Comment out call to pmap_prefault() until stability problems can be
thoroghly analyzed.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Tue Jan 24 10:12:29 1995 UTC (17 years ago) by davidg
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +12 -5 lines
Added ability to detect sequential faults and DTRT. (swap_pager.c)
Added hook for pmap_prefault() and use symbolic constant for new third
argument to vm_page_alloc() (vm_fault.c, various)
Changed the way that upages and page tables are held. (vm_glue.c)
Fixed architectural flaw in allocating pages at interrupt time that was
introduced with the merged cache changes. (vm_page.c, various)
Adjusted some algorithms to acheive better paging performance and to
accomodate the fix for the architectural flaw mentioned above. (vm_pageout.c)
Fixed pbuf handling problem, changed policy on handling read-behind page.
(vnode_pager.c)

Submitted by:	John Dyson

Revision 1.15: download - view: text, markup, annotated - select for diffs
Tue Jan 10 07:32:45 1995 UTC (17 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +2 -2 lines
Fixed some formatting weirdness that I overlooked in the previous commit.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Mon Jan 9 16:05:39 1995 UTC (17 years, 1 month ago) by davidg
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +359 -439 lines
These changes embody the support of the fully coherent merged VM buffer cache,
much higher filesystem I/O performance, and much better paging performance. It
represents the culmination of over 6 months of R&D.

The majority of the merged VM/cache work is by John Dyson.

The following highlights the most significant changes. Additionally, there are
(mostly minor) changes to the various filesystem modules (nfs, msdosfs, etc) to
support the new VM/buffer scheme.

vfs_bio.c:
Significant rewrite of most of vfs_bio to support the merged VM buffer cache
scheme.  The scheme is almost fully compatible with the old filesystem
interface.  Significant improvement in the number of opportunities for write
clustering.

vfs_cluster.c, vfs_subr.c
Upgrade and performance enhancements in vfs layer code to support merged
VM/buffer cache.  Fixup of vfs_cluster to eliminate the bogus pagemove stuff.

vm_object.c:
Yet more improvements in the collapse code.  Elimination of some windows that
can cause list corruption.

vm_pageout.c:
Fixed it, it really works better now.  Somehow in 2.0, some "enhancements"
broke the code.  This code has been reworked from the ground-up.

vm_fault.c, vm_page.c, pmap.c, vm_object.c
Support for small-block filesystems with merged VM/buffer cache scheme.

pmap.c vm_map.c
Dynamic kernel VM size, now we dont have to pre-allocate excessive numbers of
kernel PTs.

vm_glue.c
Much simpler and more effective swapping code.  No more gratuitous swapping.

proc.h
Fixed the problem that the p_lock flag was not being cleared on a fork.

swap_pager.c, vnode_pager.c
Removal of old vfs_bio cruft to support the past pseudo-coherency.  Now the
code doesn't need it anymore.

machdep.c
Changes to better support the parameter values for the merged VM/buffer cache
scheme.

machdep.c, kern_exec.c, vm_glue.c
Implemented a seperate submap for temporary exec string space and another one
to contain process upages. This eliminates all map fragmentation problems
that previously existed.

ffs_inode.c, ufs_inode.c, ufs_readwrite.c
Changes for merged VM/buffer cache.  Add "bypass" support for sneaking in on
busy buffers.

Submitted by:	John Dyson and David Greenman

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun Nov 13 22:48:53 1994 UTC (17 years, 3 months ago) by davidg
Branches: MAIN
CVS tags: RELEASE_2_0, OLAH_TTCP, BETA_2_0
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +16 -12 lines
Fixed bug where a read-behind to a negative offset would occur if the
fault was at offset 0 in the object. This resulted in more overhead but
was othewise benign. Added incore() check in vnode_pager_has_page()
to work around a problem with LFS...other than slightly higher overhead,
this change has no affect on UFS.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sun Nov 6 09:55:29 1994 UTC (17 years, 3 months ago) by davidg
Branches: MAIN
CVS tags: ALPHA_2_0
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +12 -4 lines
Fixed return status from pagers. Ahem...the previous method would manufacture
data when it couldn't get it legitimately. :-(

Submitted by:	John Dyson

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sun Oct 23 06:15:03 1994 UTC (17 years, 3 months ago) by davidg
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +9 -7 lines
Changed a thread_sleep into an spl protected tsleep. A deadlock can occur
otherwise. Minor efficiency improvement in vm_page_free().

Submitted by:	John Dyson

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Oct 22 02:18:01 1994 UTC (17 years, 3 months ago) by davidg
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +5 -3 lines
Various changes to allow operation without any swapspace configured. Note
that this is intended for use only in floppy situations and is done at
the sacrifice of performance in that case (in ther words, this is not the
best solution, but works okay for this exceptional situation).

Submitted by:	John Dyson

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sat Oct 15 13:33:07 1994 UTC (17 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +2 -3 lines
1) Some of the counters in the vmmeter struct don't fit well into the Mach VM
   scheme of things, so I've changed them to be more appropriate. page in/ous
   are now associated with the pager that did them. Nuked v_fault as the
   only fault of interest that wouldn't be already counted in v_trap is a VM
   fault, and this is counted seperately.
2) Implemented most of the remaining counters and corrected the counting of
   some that were done wrong. They are all almost correct now...just a few
   minor ones left to fix.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Sat Oct 15 10:33:47 1994 UTC (17 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +2 -2 lines
Count vm faults as v_vm_fault, not v_fault.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Sun Oct 9 01:52:07 1994 UTC (17 years, 4 months ago) by phk
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +11 -8 lines
Cosmetics:  unused vars, ()'s, #include's &c &c to silence gcc.
Reviewed by:	davidg

Revision 1.6: download - view: text, markup, annotated - select for diffs
Sun Oct 9 00:18:22 1994 UTC (17 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +2 -2 lines
Call resetpriority, not setpriority() ...oops.

Submitted by:	John Dyson

Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Oct 5 09:48:42 1994 UTC (17 years, 4 months ago) by davidg
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +4 -4 lines
Stuff object into v_vmdata rather than pager. Not important which at
the moment, but will be in the future. Other changes mostly cosmetic,
but are made for future VMIO considerations.

Submitted by:	John Dyson

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sat Aug 6 09:15:37 1994 UTC (17 years, 6 months ago) by davidg
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +5 -2 lines
Incorporated post 1.1.5 work from John Dyson. This includes performance
improvements via the new routines pmap_qenter/pmap_qremove and pmap_kenter/
pmap_kremove. These routine allow fast mapping of pages for those
architectures that have "normal" MMUs. Also included is a fix to the
pageout daemon to properly check a queue end condition.

Submitted by:	John Dyson

Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Aug 2 07:55:18 1994 UTC (17 years, 6 months ago) by davidg
Branches: MAIN
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -1 lines
Added $Id$

Revision 1.2: download - view: text, markup, annotated - select for diffs
Wed May 25 09:18:56 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +355 -85 lines
The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.

Reviewed by:	Rodney W. Grimes
Submitted by:	John Dyson and David Greenman

Revision 1.1.1.1 (vendor branch): download - view: text, markup, annotated - select for diffs
Tue May 24 10:09:50 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: CSRG
CVS tags: bsd_44_lite, REL_before_johndavid_2_0_0
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +0 -0 lines
BSD 4.4 Lite Kernel Sources

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue May 24 10:09:49 1994 UTC (17 years, 8 months ago) by rgrimes
Branches: MAIN
Initial revision

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options