OpenBSD CVS

CVS log for src/sys/uvm/uvm_fault.c


[BACK] Up to [local] / src / sys / uvm

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.135 / (download) - annotate - [select for diffs], Tue Sep 5 05:08:26 2023 UTC (9 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.134: +15 -2 lines
Diff to previous 1.134 (colored)

Address the case 2b version of inconsistent view across threads of
a page undergoing copy-on-write faulting.  We fixed the case 1b
version in rev 1.125 (2022-02-01), but missed this other path.

jsg@ noted that in NetBSD Chuck Silvers had a relevant commit, their
rev 1.234 (2023-08-13), which looks like it fixed both cases due
to their refactoring of common code into a uvmfault_promote()
function.

ok mpi@ jca@

Revision 1.134 / (download) - annotate - [select for diffs], Sat Sep 2 08:24:40 2023 UTC (9 months, 1 week ago) by mpi
Branch: MAIN
Changes since 1.133: +1 -2 lines
Diff to previous 1.133 (colored)

Zap anon pages mappings in uvm_anon_release() instead of in the fault handler.

This makes all code paths deactivating or freeing anons consistent.

No objection from the usual suspects.

Revision 1.133 / (download) - annotate - [select for diffs], Fri Nov 4 09:36:44 2022 UTC (19 months, 1 week ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.132: +2 -1 lines
Diff to previous 1.132 (colored)

Assert the VM map lock is held in function used by mmap/mprotect/munmap.

Also grab the lock in uvm_map_teardown() and uvm_map_deallocate() to
satisfy the assertions.  Grabbing the lock there shouldn't be strictly
necessary, because no other reference to the map should exist when the
reaper is holding it, but it doesn't hurt and makes our life easier.

Inputs & tests from Ivo van der Sangen, tb@, gnezdo@, kn@

kettenis@ and tb@ agree with the direction, ok kn@

Revision 1.132 / (download) - annotate - [select for diffs], Wed Aug 31 01:27:04 2022 UTC (21 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.131: +3 -2 lines
Diff to previous 1.131 (colored)

Refine the change in rev 1.125: the UVM mitigation for CoW faulting
when multiple CPUs are running threads in the process is only needed
when there can be multiple CPUs, so save a fault on SP builds.

ok miod@ mpi@

Revision 1.131 / (download) - annotate - [select for diffs], Tue Jun 28 10:45:55 2022 UTC (23 months, 2 weeks ago) by mpi
Branch: MAIN
Changes since 1.130: +4 -5 lines
Diff to previous 1.130 (colored)

Do not clean PG_BUSY before calling uvm_anon_release().

Fix an assertion reported by gkoehler@.

ok kettenis@

Revision 1.130 / (download) - annotate - [select for diffs], Tue Jun 28 10:38:55 2022 UTC (23 months, 2 weeks ago) by mpi
Branch: MAIN
Changes since 1.129: +11 -1 lines
Diff to previous 1.129 (colored)

Do not consider adjacent pages when doing a CoW.

Those pages should already be entered, this speeds up CoW faults.

Stolen from NetBSD.

ok miod@, kettenis@

Revision 1.129 / (download) - annotate - [select for diffs], Mon Apr 4 09:27:05 2022 UTC (2 years, 2 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.128: +8 -4 lines
Diff to previous 1.128 (colored)

Replace KASSERT in uvm_fault_unwire_locked() with code that handles the
case where not all pages are wired.  The KASSERT can be triggered in
multi-threaded applications when a thread calling munmap(2) races another
thread that invokes sysctl(2).  Properly written code shouldn't do this,
but making the kernel crash in this case is a bit harsh.

ok gezdo@, deraadt@

Fixes:
Reported-by: syzbot+e8310909e2910c9cca08@syzkaller.appspotmail.com

Revision 1.128 / (download) - annotate - [select for diffs], Fri Feb 11 09:25:04 2022 UTC (2 years, 3 months ago) by kn
Branch: MAIN
Changes since 1.127: +0 -1 lines
Diff to previous 1.127 (colored)

Backout previous "Assert vm map locks" (commitid: sRNBfzX2dJrxFDmb)

WITNESS builds broke as reported by anton and bluhm:

	root on sd0a (5ec49b3ad23eb2d4.a) swap on sd0b dump on sd0b
	kernel: protection fault trap, code=0
	Stopped at      witness_checkorder+0x4ec:       movl    0x10(%r12),%ecx

https://syzkaller.appspot.com/bug?id=be02b290a93c648986c35370a271aad4135a5044
https://syzkaller.appspot.com/text?tag=CrashLog&x=136e9aa4700000

Revision 1.127 / (download) - annotate - [select for diffs], Thu Feb 10 10:15:35 2022 UTC (2 years, 4 months ago) by kn
Branch: MAIN
Changes since 1.126: +2 -1 lines
Diff to previous 1.126 (colored)

Assert vm map locks

Introduce vm_map_assert_{wrlock,rdlock,anylock,unlocked}() in rwlock(9)
fashion and back up function comments about locking assumptions with proper
assertions.

Also add new comments/assertions based on code analysis and sync with
NetBSD as much as possible.

vm_map_lock() and vm_map_lock_read() are used for exclusive and shared
access respectively;  currently no code path is purely protected by
vm_map_lock_read() alone, i.e. functions called with a read lock held by the
callee are also called with a write lock elsewhere.

Thus only vm_map_assert_{wrlock,anylock}() are used as of now.

This should help with unlocking UVM related syscalls

Tested as part of a larger diff through
- amd64 package bulk build by naddy
- amd64, arm64, powerpc64 base builds and regress by bluhm
- amd64 and sparc64 base builds and regress by me

Input mpi
Feedback OK kettenis

Revision 1.126 / (download) - annotate - [select for diffs], Thu Feb 3 19:57:11 2022 UTC (2 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.125: +4 -2 lines
Diff to previous 1.125 (colored)

The sparc64 pmap at least requires the fault access_type to be a
subset of the request permissions, so when forcing an initial RO
fault for CoW also clamp the access_type.

problem reported by bluhm@
based on a suggestion from miod@
ok kettenis@

Revision 1.125 / (download) - annotate - [select for diffs], Tue Feb 1 08:38:53 2022 UTC (2 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.124: +13 -1 lines
Diff to previous 1.124 (colored)

Attempt to guarantee that on copy-on-write faulting, the new copy
can't be written to while any thread can see the original version
of the page via a not-yet-flushed stale TLB entry: pmaps can indicate
they do this correctly by defining __HAVE_PMAP_MPSAFE_ENTER_COW;
uvm will force the initial CoW fault to be read-only otherwise.

Set that on amd64 and fix the problem case in pmap_enter() by putting
a read-only mapping in place, shooting the TLB entry, then fixing
it to the final read-write entry so this thread can continue without
re-faulting.

reported by jsing@ from https://github.com/golang/go/issues/34988
assisted by discussion in https://reviews.freebsd.org/D14347
tweaks from jsing@ and kettenis@

ok jsing@ mpi@ kettenis@

Revision 1.124 / (download) - annotate - [select for diffs], Tue Dec 28 13:16:28 2021 UTC (2 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.123: +1 -3 lines
Diff to previous 1.123 (colored)

Unlock bottom part of the fault handler.

Tested by many during the past months, thanks!

ok sthen@

Revision 1.123 / (download) - annotate - [select for diffs], Fri Dec 17 14:18:15 2021 UTC (2 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.122: +3 -2 lines
Diff to previous 1.122 (colored)

Do not try to unlock a NULL object.

Fix a NULL dereference introduced in previous, reported by anton@ and
Benjamin Baier.

Reported-by: syzbot+c172bd335801b67e515b@syzkaller.appspotmail.com

Revision 1.122 / (download) - annotate - [select for diffs], Wed Dec 15 12:53:53 2021 UTC (2 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.121: +63 -19 lines
Diff to previous 1.121 (colored)

Use a per-UVM object lock to serialize the lower part of the fault handler.

Like the per-amap lock the `vmobjlock' is principally used to serialized
access to objects in the fault handler to allow faults occurring on
different CPUs and different objects to be processed in parallel.

The fault handler now acquires the `vmobjlock' of a given UVM object as
soon as it finds one.  For now a write-lock is always acquired even if
some operations could use a read-lock.

Every pager, corresponding to a different kind of UVM object, now expect
the UVM object to be locked and some operations, like *_get() return it
unlocked.  This is enforced by assertions checking for rw_write_held().

The KERNEL_LOCK() is now pushed to the VFS boundary in the vnode pager.

To ensure the correct amap or object lock is held when modifying a page
many uvm_page* operations are now asserting for the "owner" lock.
However, fields of the "struct vm_page" are still being protected by the
global `pageqlock'.  To prevent lock ordering issues with the new
`vmobjlock' and to reduce differences with NetBSD this lock is now taken
and released for each page instead of around the whole loop.

This commit does not remove the KERNEL_LOCK/UNLOCK() dance.  Unlocking
will follow if there is no fallout.

Ported from NetBSD, tested by many, thanks!

ok kettenis@, kn@

Revision 1.121 / (download) - annotate - [select for diffs], Tue Oct 12 07:38:22 2021 UTC (2 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

Fix the deadlock between uvn_io() and uvn_flush() by restarting the fault.

Do not allow a faulting thread to sleep on a contended vnode lock to prevent
lock ordering issues with upcoming per-uobj lock.

Also reduce the sleep value for VM_PAGER_AGAIN from 1sec to 5nsec to not add
visible slowdown when starting a multi-threaded application with threads that
fault on the same vnode (chromium, firefox, etc).

Tested by anton@, tb@, robert@ and gnezdo@

ok anton@, tb@

Reported-by: syzbot+e63407b35dff08dbee02@syzkaller.appspotmail.com

Revision 1.120 / (download) - annotate - [select for diffs], Fri Mar 26 13:40:05 2021 UTC (3 years, 2 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.119: +6 -6 lines
Diff to previous 1.119 (colored)

Remove parenthesis around return value to reduce the diff with NetBSD.

No functional change.

ok mlarkin@

Revision 1.119 / (download) - annotate - [select for diffs], Sat Mar 20 10:24:21 2021 UTC (3 years, 2 months ago) by mpi
Branch: MAIN
Changes since 1.118: +59 -25 lines
Diff to previous 1.118 (colored)

Sync some comments in order to reduce the difference with NetBSD.

No functionnal change.

ok kettenis@

Revision 1.118 / (download) - annotate - [select for diffs], Fri Mar 12 14:15:49 2021 UTC (3 years, 3 months ago) by jsg
Branch: MAIN
Changes since 1.117: +2 -2 lines
Diff to previous 1.117 (colored)

spelling

ok mpi@

Revision 1.117 / (download) - annotate - [select for diffs], Mon Mar 1 09:09:35 2021 UTC (3 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.116: +98 -76 lines
Diff to previous 1.116 (colored)

Move the top part of uvm_fault_lower(), the lookup, in its own function.

The name and logic come from NetBSD in order to reduce the difference
between the two code bases.

No functional change intended.

ok tb@

Revision 1.116 / (download) - annotate - [select for diffs], Tue Feb 23 10:41:59 2021 UTC (3 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.115: +32 -25 lines
Diff to previous 1.115 (colored)

Move `pgo_fault' handler outside of uvm_fault_lower().

Reduce differences with NetBSD and prepare for `uobj' locking.

No functionnal change. ok chris@, kettenis@

Revision 1.115 / (download) - annotate - [select for diffs], Tue Feb 16 09:10:17 2021 UTC (3 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.114: +284 -224 lines
Diff to previous 1.114 (colored)

Comments & style cleanup, no functional change intended.

- Sync comments with NetBSD including locking details.
- Remove superfluous parenthesis and spaces.
- Add brackets, even if questionable, to reduce diff with NetBSD
- Use for (;;) instead of while(1)
- Rename a variable from 'result' into 'error'.
- Move uvm_fault() and uvm_fault_upper_lookup()
- Add an locking assert in uvm_fault_upper_lookup()

ok tb@, mlarkin@

Revision 1.114 / (download) - annotate - [select for diffs], Mon Feb 15 12:12:54 2021 UTC (3 years, 3 months ago) by mpi
Branch: MAIN
Changes since 1.113: +3 -3 lines
Diff to previous 1.113 (colored)

Fix double unlock in uvmfault_anonget().

Reported by and ok jsg@

Revision 1.113 / (download) - annotate - [select for diffs], Tue Jan 19 13:21:36 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.112: +52 -10 lines
Diff to previous 1.112 (colored)

(re)Introduce locking for amaps & anons.

A rwlock is attached to every amap and is shared with all its anon.  The
same lock will be used by multiple amaps if they have anons in common.

This should be enough to get the upper part of the fault handler out of the
KERNEL_LOCK() which seems to bring up to 20% improvements in builds.

This is based/copied/adapted from the most recent work done in NetBSD which
is an evolution of the precendent simple_lock scheme.

Tested by many, thanks!

ok kettenis@, mvs@

Revision 1.112 / (download) - annotate - [select for diffs], Sat Jan 16 18:32:47 2021 UTC (3 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.111: +20 -20 lines
Diff to previous 1.111 (colored)

Move `access_type' to the fault context.

Fix a regression where the valye wasn't correctly overwritten for wired
mapping, introduced in previous refactoring.

ok mvs@

Revision 1.111 / (download) - annotate - [select for diffs], Sat Jan 2 02:39:59 2021 UTC (3 years, 5 months ago) by cheloha
Branch: MAIN
Changes since 1.110: +3 -2 lines
Diff to previous 1.110 (colored)

uvm: uvm_fault_lower(): don't sleep on lbolt

We can simulate the current behavior without lbolt by sleeping for 1
second on the &nowake channel.

ok mpi@

Revision 1.110 / (download) - annotate - [select for diffs], Mon Dec 28 14:01:23 2020 UTC (3 years, 5 months ago) by mpi
Branch: MAIN
Changes since 1.109: +26 -25 lines
Diff to previous 1.109 (colored)

Use per-CPU counters for fault and stats counters reached in uvm_fault().

ok kettenis@, dlg@

Revision 1.109 / (download) - annotate - [select for diffs], Tue Dec 8 12:26:31 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.108: +23 -34 lines
Diff to previous 1.108 (colored)

Use a while loop instead of goto in uvm_fault().

ok jmatthew@, tb@

Revision 1.108 / (download) - annotate - [select for diffs], Thu Nov 19 17:06:40 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.107: +77 -63 lines
Diff to previous 1.107 (colored)

Move logic handling lower faults, case 2, to its own function.

No functionnal change.

ok kettenis@, jmatthew@, tb@

Revision 1.107 / (download) - annotate - [select for diffs], Mon Nov 16 12:30:16 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.106: +17 -23 lines
Diff to previous 1.106 (colored)

Remove Case2 goto, use a simple if () instead.

ok tb@, jmatthew@

Revision 1.106 / (download) - annotate - [select for diffs], Fri Nov 13 14:18:25 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.105: +81 -56 lines
Diff to previous 1.105 (colored)

Use a helper to look for existing mapping & return if there's an anon.

Separate fault handling code for type 1 and 2 and reduce differences
with NetBSD.

ok tb@, jmatthew@, kettenis@

Revision 1.105 / (download) - annotate - [select for diffs], Fri Nov 13 11:16:08 2020 UTC (3 years, 6 months ago) by mpi
Branch: MAIN
Changes since 1.104: +173 -151 lines
Diff to previous 1.104 (colored)

Move the logic dealing with faults 1A & 1B to its own function.

Some minor documentation improvments and style nits but this should
not contain any functionnal change.

ok tb@

Revision 1.104 / (download) - annotate - [select for diffs], Fri Nov 6 11:52:39 2020 UTC (3 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.103: +17 -19 lines
Diff to previous 1.103 (colored)

Remove unused `anon' argument from uvmfault_unlockall().

It won't be used when amap and anon locking will be introduced.

This "fixes" passing a unrelated/uninitialized pointer in an error path
in case of memory shortage.

ok kettenis@

Revision 1.103 / (download) - annotate - [select for diffs], Wed Oct 21 08:55:40 2020 UTC (3 years, 7 months ago) by mpi
Branch: MAIN
Changes since 1.102: +170 -113 lines
Diff to previous 1.102 (colored)

Move the top part of uvm_fault() (lookups, checks, etc) in their own function.

The name, uvm_fault_check() and logic comes from NetBSD as reuducing diff
with their tree is useful to learn from their experience and backport fixes.

No functional change intended.

ok kettenis@

Revision 1.102 / (download) - annotate - [select for diffs], Tue Sep 29 11:47:41 2020 UTC (3 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.101: +6 -11 lines
Diff to previous 1.101 (colored)

Introduce a helper to check if all available swap is in use.

This reduces code duplication, reduces the diff with NetBSD and will help
to introduce locks around global variables.

ok cheloha@

Revision 1.101 / (download) - annotate - [select for diffs], Thu Sep 24 09:51:07 2020 UTC (3 years, 8 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.100: +39 -39 lines
Diff to previous 1.100 (colored)

Remove trailing white spaces.

Revision 1.100 / (download) - annotate - [select for diffs], Tue Sep 22 14:31:08 2020 UTC (3 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored)

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@

Revision 1.99 / (download) - annotate - [select for diffs], Tue Sep 22 14:29:20 2020 UTC (3 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.98: +1 -8 lines
Diff to previous 1.98 (colored)

Kill outdated comment, pmap_enter(9) doesn't sleep.

ok kettenis@

Revision 1.98 / (download) - annotate - [select for diffs], Sat Sep 12 17:08:49 2020 UTC (3 years, 8 months ago) by mpi
Branch: MAIN
Changes since 1.97: +3 -1 lines
Diff to previous 1.97 (colored)

Add tracepoints in the page fault handler and when entries are added to maps.

ok kettenis@

Revision 1.97 / (download) - annotate - [select for diffs], Sun Dec 8 12:37:45 2019 UTC (4 years, 6 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

Convert infinite sleeps to {m,t}sleep_nsec(9).

ok visa@, jca@

Revision 1.96 / (download) - annotate - [select for diffs], Thu Jul 18 23:47:33 2019 UTC (4 years, 10 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

R.I.P. UVM_WAIT().  Use tsleep_nsec(9) directly.

UVM_WAIT() doesn't provide much of a useful abstraction.  All callers
tsleep forever and no callers set PCATCH, so only 2 of 4 parameters are
actually used.  Might as well just use tsleep_nsec(9) directly and make
the uvm code a bit less specialized.

Suggested by mpi@.

ok mpi@ visa@ millert@

Revision 1.95 / (download) - annotate - [select for diffs], Sun Feb 3 05:33:48 2019 UTC (5 years, 4 months ago) by visa
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.94: +3 -1 lines
Diff to previous 1.94 (colored)

Always refault if relocking maps fails after IO. This fixes a regression
introduced with __MAP_NOFAULT. The regression let uvm_fault() run
without proper locking and rechecking of state after map version change
if page zero-fill was chosen.

OK kettenis@ deraadt@

Reported-by: syzbot+9972088c1026668c6c5c@syzkaller.appspotmail.com

Revision 1.94 / (download) - annotate - [select for diffs], Wed Oct 31 08:50:25 2018 UTC (5 years, 7 months ago) by kettenis
Branch: MAIN
Changes since 1.93: +11 -10 lines
Diff to previous 1.93 (colored)

Add support to uvm to establish write-combining mappings.  Use this in the
inteldrm driver to add support for the I915_MMAP_WC flag.

ok deraadt@, jsg@

Revision 1.93 / (download) - annotate - [select for diffs], Thu Apr 12 17:13:44 2018 UTC (6 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.92: +3 -2 lines
Diff to previous 1.92 (colored)

Implement MAP_STACK option for mmap().  Synchronous faults (pagefault and
syscall) confirm the stack register points at MAP_STACK memory, otherwise
SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified
to create a MAP_STACK sub-region which satisfies alignment requirements.
Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the
contents of the region -- there is no mprotect() equivalent operation, so
there is no MAP_STACK-adding gadget.
This opportunistic software-emulation of a stack protection bit makes
stack-pivot operations during ROPchain fragile (kind of like removing a
tool from the toolbox).
original discussion with tedu, uvm work by stefan, testing by mortimer
ok kettenis

Revision 1.92 / (download) - annotate - [select for diffs], Thu Jul 20 18:22:25 2017 UTC (6 years, 10 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

Accessing a mmap(2)ed file behind its end should result in a SIGBUS
according to POSIX.  Bring regression test and kernel in line for
amd64 and i386.  Other architectures have to follow.
OK deraadt@ kettenis@

Revision 1.91 / (download) - annotate - [select for diffs], Fri Sep 16 01:09:53 2016 UTC (7 years, 8 months ago) by dlg
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.90: +2 -2 lines
Diff to previous 1.90 (colored)

move the uvm_map_addr RB tree from RB macros to the RBT functions

this tree is interesting because it uses all the red black tree
features, specifically the augment callback thats called on tree
topology changes, and it poisons and checks entries as theyre removed
from and inserted back into the tree respectively.

ok stefan@

Revision 1.90 / (download) - annotate - [select for diffs], Sun May 8 11:52:32 2016 UTC (8 years, 1 month ago) by stefan
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.89: +44 -18 lines
Diff to previous 1.89 (colored)

Wait for RAM in uvm_fault when allocating uvm structures fails

Only fail hard when running out of swap space also, as suggested by
kettenis@

While there, let amap_add() return a success status and handle
amap_add() errors in uvm_fault() similar to other out of RAM situations.
These bits are needed for further amap reorganization diffs.

lots of feedback and ok kettenis@

Revision 1.89 / (download) - annotate - [select for diffs], Tue Mar 29 12:04:26 2016 UTC (8 years, 2 months ago) by chl
Branch: MAIN
Changes since 1.88: +1 -4 lines
Diff to previous 1.88 (colored)

Remove dead assignments and now unused variables.

Found by LLVM/Clang Static Analyzer.

ok mpi@ stefan@

Revision 1.88 / (download) - annotate - [select for diffs], Mon Mar 7 18:44:00 2016 UTC (8 years, 3 months ago) by naddy
Branch: MAIN
Changes since 1.87: +2 -2 lines
Diff to previous 1.87 (colored)

Sync no-argument function declaration and definition by adding (void).
ok mpi@ millert@

Revision 1.87 / (download) - annotate - [select for diffs], Tue Nov 10 08:21:28 2015 UTC (8 years, 7 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.86: +11 -1 lines
Diff to previous 1.86 (colored)


UVM change needed for vmm.

discussed with miod, deraadt, and guenther.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Sep 9 14:52:12 2015 UTC (8 years, 9 months ago) by miod
Branch: MAIN
Changes since 1.85: +1 -15 lines
Diff to previous 1.85 (colored)

All our pmap implementations provide pmap_resident_count(), so remove
#ifndef pmap_resident_count code paths.

Revision 1.85 / (download) - annotate - [select for diffs], Fri Aug 21 16:04:35 2015 UTC (8 years, 9 months ago) by visa
Branch: MAIN
Changes since 1.84: +15 -175 lines
Diff to previous 1.84 (colored)

Remove the unused loan_count field and the related uvm logic. Most of
the page loaning code is already in the Attic.

ok kettenis@, beck@

Revision 1.84 / (download) - annotate - [select for diffs], Sat Mar 14 03:38:53 2015 UTC (9 years, 3 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.83: +1 -2 lines
Diff to previous 1.83 (colored)

Remove some includes include-what-you-use claims don't
have any direct symbols used.  Tested for indirect use by compiling
amd64/i386/sparc64 kernels.

ok tedu@ deraadt@

Revision 1.83 / (download) - annotate - [select for diffs], Sun Feb 8 02:17:08 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.82: +0 -1 lines
Diff to previous 1.82 (colored)

Something is subtly wrong with this.  On ramdisks, processes run out of
mappable memory (direct or via execve), perhaps because of the address
allocator behind maps and the way wiring counts work?

Revision 1.82 / (download) - annotate - [select for diffs], Fri Feb 6 10:58:35 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.81: +2 -1 lines
Diff to previous 1.81 (colored)

Clear PQ_AOBJ before calling uvm_pagefree(), clearing up one false XXX
comment (one is fixed, one is deleted).
ok kettenis beck

Revision 1.81 / (download) - annotate - [select for diffs], Wed Dec 17 06:58:11 2014 UTC (9 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.80: +5 -5 lines
Diff to previous 1.80 (colored)

Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latter
doesn't have all the values and therefore can't be used everywhere.

ok deraadt@ kettenis@

Revision 1.80 / (download) - annotate - [select for diffs], Mon Dec 15 02:24:23 2014 UTC (9 years, 5 months ago) by guenther
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (colored)

Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro,
eliminating the must-be-kept-in-sync UVM_INH_* macros

ok deraadt@ tedu@

Revision 1.79 / (download) - annotate - [select for diffs], Sun Nov 16 12:31:00 2014 UTC (9 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.78: +23 -24 lines
Diff to previous 1.78 (colored)

Replace a plethora of historical protection options with just
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h.
PROT_MASK is introduced as the one true way of extracting those bits.
Remove UVM_ADV_* wrapper, using the standard names.
ok doug guenther kettenis

Revision 1.78 / (download) - annotate - [select for diffs], Fri Oct 3 17:41:00 2014 UTC (9 years, 8 months ago) by kettenis
Branch: MAIN
Changes since 1.77: +7 -3 lines
Diff to previous 1.77 (colored)

Introduce __MAP_NOFAULT, a mmap(2) flag that makes sure a mapping will not
cause a SIGSEGV or SIGBUS when a mapped file gets truncated.  Access to
pages that are not backed by a file on such a mapping will be replaced by
zero-filled anonymous pages.  Makes passing file descriptors of mapped files
usable without having to play tricks with signal handlers.

"steal your mmap flag" deraadt@

Revision 1.77 / (download) - annotate - [select for diffs], Sun Sep 7 08:17:44 2014 UTC (9 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.76: +2 -2 lines
Diff to previous 1.76 (colored)

typo in comment

Revision 1.76 / (download) - annotate - [select for diffs], Fri Jul 11 16:35:40 2014 UTC (9 years, 11 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.75: +1 -8 lines
Diff to previous 1.75 (colored)

Chuck Cranor rescinded clauses in his license
on the 2nd of February 2011 in NetBSD.

http://marc.info/?l=netbsd-source-changes&m=129658899212732&w=2
http://marc.info/?l=netbsd-source-changes&m=129659095515558&w=2
http://marc.info/?l=netbsd-source-changes&m=129659157916514&w=2
http://marc.info/?l=netbsd-source-changes&m=129665962324372&w=2
http://marc.info/?l=netbsd-source-changes&m=129666033625342&w=2
http://marc.info/?l=netbsd-source-changes&m=129666052825545&w=2
http://marc.info/?l=netbsd-source-changes&m=129666922906480&w=2
http://marc.info/?l=netbsd-source-changes&m=129667725518082&w=2

Revision 1.75 / (download) - annotate - [select for diffs], Tue Jul 8 11:38:48 2014 UTC (9 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.74: +1 -5 lines
Diff to previous 1.74 (colored)

bye bye UBC; ok beck dlg

Revision 1.74 / (download) - annotate - [select for diffs], Thu Jul 3 11:38:46 2014 UTC (9 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.73: +8 -10 lines
Diff to previous 1.73 (colored)

It is important that we don't release the kernel lock between issuing a
wakeup and clearing the PG_BUSY and PG_WANTED flags, so try to keep those
bits as close together and defenitely avoid calling random code in between.

ok guenther@, tedu@

Revision 1.73 / (download) - annotate - [select for diffs], Thu May 8 20:08:50 2014 UTC (10 years, 1 month ago) by kettenis
Branch: MAIN
Changes since 1.72: +4 -4 lines
Diff to previous 1.72 (colored)

Fix some potential integer overflows caused by converting a page number into
an offset/size/address by shifting by PAGE_SHIFT.  Make uvm_objwrire/unwire
use voff_t instead of off_t.  The former is the right type here even if it is
equivalent to the latter.

Inspired by a somewhat similar changes in Bitrig.

ok deraadt@, guenther@

Revision 1.72 / (download) - annotate - [select for diffs], Sun Apr 13 23:14:15 2014 UTC (10 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.71: +48 -264 lines
Diff to previous 1.71 (colored)

compress code by turning four line comments into one line comments.
emphatic ok usual suspects, grudging ok miod

Revision 1.71 / (download) - annotate - [select for diffs], Thu Apr 3 20:21:01 2014 UTC (10 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.70: +27 -12 lines
Diff to previous 1.70 (colored)

uvm_fault() will try to fault neighbouring pages for the MADV_NORMAL case,
which is the default, unless the fault call is explicitly used to wire a given
page.

The amount of pages being faulted in was borrowed from the FreeBSD VM code,
about 15 years ago, at a time FreeBSD was only reliably running on 4KB page
size systems.

It is questionable whether faulting the same amount of pages, on platforms
where the page size is larger, is a good idea, as it may cause too much I/O.

Add an uvmfault_init() routine, which will compute the proper number of pages
at runtime, depending upon the actual page size, and attempting to fault in
the same overall size the previous code would have done with 4KB pages.

ok tedu@

Revision 1.70 / (download) - annotate - [select for diffs], Mon Mar 31 20:16:39 2014 UTC (10 years, 2 months ago) by miod
Branch: MAIN
Changes since 1.69: +3 -2 lines
Diff to previous 1.69 (colored)

In uvm_fault(), when attempting to map backpages and forwpages, defer
the pmap_update() to the end of the loop, rather than after each loop
iteration - which might not even end up invoking pmap_enter()!

Quiet blessing from guenther@ deraadt@

Revision 1.69 / (download) - annotate - [select for diffs], Thu May 30 18:02:04 2013 UTC (11 years ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

in the brave new world of void *, we don't need caddr_t casts

Revision 1.68 / (download) - annotate - [select for diffs], Thu May 30 16:39:26 2013 UTC (11 years ago) by tedu
Branch: MAIN
Changes since 1.67: +3 -6 lines
Diff to previous 1.67 (colored)

UVM_UNLOCK_AND_WAIT no longer unlocks, so rename it to UVM_WAIT.

Revision 1.67 / (download) - annotate - [select for diffs], Thu May 30 16:29:46 2013 UTC (11 years ago) by tedu
Branch: MAIN
Changes since 1.66: +20 -92 lines
Diff to previous 1.66 (colored)

remove lots of comments about locking per beck's request

Revision 1.66 / (download) - annotate - [select for diffs], Thu May 30 15:17:59 2013 UTC (11 years ago) by tedu
Branch: MAIN
Changes since 1.65: +1 -27 lines
Diff to previous 1.65 (colored)

remove simple_locks from uvm code. ok beck deraadt

Revision 1.65 / (download) - annotate - [select for diffs], Thu Apr 12 11:55:43 2012 UTC (12 years, 2 months ago) by ariane
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.64: +46 -1 lines
Diff to previous 1.64 (colored)

uvm: keep track of maxrss

The fault path is used to update the maxrss of the faulting proc.
Doesn't affect anything, as it was 0 before.

Requested by espie, "just commit it" deraadt

Revision 1.64 / (download) - annotate - [select for diffs], Fri Mar 23 15:51:26 2012 UTC (12 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.63: +5 -5 lines
Diff to previous 1.63 (colored)

Make rusage totals, itimers, and profile settings per-process instead
of per-rthread.  Handling of per-thread tick and runtime counters
inspired by how FreeBSD does it.

ok kettenis@

Revision 1.63 / (download) - annotate - [select for diffs], Fri Mar 9 13:01:29 2012 UTC (12 years, 3 months ago) by ariane
Branch: MAIN
Changes since 1.62: +9 -6 lines
Diff to previous 1.62 (colored)

New vmmap implementation.

no oks (it is really a pain to review properly)
extensively tested, I'm confident it'll be stable
'now is the time' from several icb inhabitants

Diff provides:
- ability to specify different allocators for different regions/maps
- a simpler implementation of the current allocator
- currently in compatibility mode: it will generate similar addresses
  as the old allocator

Revision 1.62 / (download) - annotate - [select for diffs], Sun Jul 3 18:34:14 2011 UTC (12 years, 11 months ago) by oga
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.61: +2 -82 lines
Diff to previous 1.61 (colored)

Rip out and burn support for UVM_HIST.

The vm hackers don't use it, don't maintain it and have to look at it all the
time. About time this 800 lines of code hit /dev/null.

``never liked it'' tedu@. ariane@ was very happy when i told her i wrote
this diff.

Revision 1.61 / (download) - annotate - [select for diffs], Thu Jun 23 21:52:42 2011 UTC (12 years, 11 months ago) by oga
Branch: MAIN
Changes since 1.60: +2 -6 lines
Diff to previous 1.60 (colored)

Replace handrolled version of uvmfault_unlockmaps with uvmfault_unlockmaps.

ok ariane@

Revision 1.60 / (download) - annotate - [select for diffs], Mon Jun 6 17:10:23 2011 UTC (13 years ago) by ariane
Branch: MAIN
Changes since 1.59: +7 -6 lines
Diff to previous 1.59 (colored)

Backout vmmap in order to repair virtual address selection algorithms
outside the tree.

Revision 1.59 / (download) - annotate - [select for diffs], Tue May 24 15:27:36 2011 UTC (13 years ago) by ariane
Branch: MAIN
Changes since 1.58: +6 -7 lines
Diff to previous 1.58 (colored)

Reimplement uvm/uvm_map.

vmmap is designed to perform address space randomized allocations,
without letting fragmentation of the address space go through the roof.

Some highlights:
- kernel address space randomization
- proper implementation of guardpages
- roughly 10% system time reduction during kernel build

Tested by alot of people on tech@ and developers.
Theo's machines are still happy.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jul 22 21:05:37 2009 UTC (14 years, 10 months ago) by oga
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.57: +14 -43 lines
Diff to previous 1.57 (colored)

Put the PG_RELEASED changes diff back in.

This has has been tested very very thoroughly on all archs we have
excepting 88k and 68k. Please see cvs log for the individual commit
messages.

ok beck@, thib@

Revision 1.57 / (download) - annotate - [select for diffs], Tue Jun 16 23:54:58 2009 UTC (14 years, 11 months ago) by oga
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 (colored)

date based reversion of uvm to the 4th May.

We still have no idea why this stops the crashes. but it does.

a machine forced to 64mb of ram cycled 10GB through swap with this diff
and is still running as I type this. Other tests by ariane@ and thib@
also seem to show that it's alright.

ok deraadt@, thib@, ariane@

Revision 1.56 / (download) - annotate - [select for diffs], Tue Jun 16 00:11:29 2009 UTC (14 years, 11 months ago) by oga
Branch: MAIN
Changes since 1.55: +48 -14 lines
Diff to previous 1.55 (colored)

Backout all changes to uvm after pmemrange (which will be backed out
separately).

a change at or just before the hackathon has either exposed or added a
very very nasty memory corruption bug that is giving us hell right now.
So in the interest of kernel stability these diffs are being backed out
until such a time as that corruption bug has been found and squashed,
then the ones that are proven good may slowly return.

a quick hitlist of the main commits this backs out:

mine:
uvm_objwire
the lock change in uvm_swap.c
using trees for uvm objects instead of the hash
removing the pgo_releasepg callback.

art@'s:
putting pmap_page_protect(VM_PROT_NONE) in uvm_pagedeactivate() since
all callers called that just prior anyway.

ok beck@, ariane@.

prompted by deraadt@.

Revision 1.55 / (download) - annotate - [select for diffs], Sat Jun 6 17:46:44 2009 UTC (15 years ago) by art
Branch: MAIN
Changes since 1.54: +1 -6 lines
Diff to previous 1.54 (colored)

Since all callers of uvm_pagedeactivate did pmap_page_protect(.., VM_PROT_NONE)
just move that into uvm_pagedeactivate.

oga@ ok

Revision 1.54 / (download) - annotate - [select for diffs], Mon Jun 1 19:54:02 2009 UTC (15 years ago) by oga
Branch: MAIN
Changes since 1.53: +14 -43 lines
Diff to previous 1.53 (colored)

Since we've now cleared up a lot of the PG_RELEASED setting, remove the
pgo_releasepg() hook and just free the page the "normal" way in the one
place we'll ever see PG_RELEASED and should care (uvm_page_unbusy,
called in aiodoned).

ok art@, beck@, thib@

Revision 1.53 / (download) - annotate - [select for diffs], Fri May 8 13:50:15 2009 UTC (15 years, 1 month ago) by ariane
Branch: MAIN
Changes since 1.52: +3 -3 lines
Diff to previous 1.52 (colored)

Remove static qualifier of functions that are not inline.
Makes trace in ddb useful.

ok oga

Revision 1.52 / (download) - annotate - [select for diffs], Wed Mar 25 20:00:18 2009 UTC (15 years, 2 months ago) by oga
Branch: MAIN
Changes since 1.51: +161 -1 lines
Diff to previous 1.51 (colored)

Move all of the pseudo-inline functions in uvm into C files.

By pseudo-inline, I mean that if a certain macro was defined, they would
be inlined. However, no architecture defines that, and none has for a
very very long time. Therefore mainly this just makes the code a damned
sight easier to read. Some k&r -> ansi declarations while I'm in there.

"just commit it" art@. ok weingart@.

Revision 1.51 / (download) - annotate - [select for diffs], Fri Mar 20 15:19:04 2009 UTC (15 years, 2 months ago) by oga
Branch: MAIN
Changes since 1.50: +10 -25 lines
Diff to previous 1.50 (colored)

While working on some stuff in uvm I've gotten REALLY sick of reading
K&R function declarations, so switch them all over to ansi-style, in
accordance with the prophesy.

"go for it" art@

Revision 1.50 / (download) - annotate - [select for diffs], Tue Sep 16 18:52:52 2008 UTC (15 years, 8 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

remove dead stores and newly created unused variables.

Found by LLVM/Clang Static Analyzer.

ok miod@ art@

Revision 1.49 / (download) - annotate - [select for diffs], Mon Jun 18 21:51:15 2007 UTC (16 years, 11 months ago) by pedro
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.48: +20 -20 lines
Diff to previous 1.48 (colored)

Bring back Mickey's UVM anon change. Testing by thib@, beck@ and
ckuethe@ for a while. Okay beck@, "it is good timing" deraadt@.

Revision 1.48 / (download) - annotate - [select for diffs], Thu May 31 21:20:30 2007 UTC (17 years ago) by thib
Branch: MAIN
Changes since 1.47: +1 -7 lines
Diff to previous 1.47 (colored)

zap the vm_amap am_l simplelock, and amap_{lock/unlock} macros for
simple_{lock/unlock}.

ok art@

Revision 1.47 / (download) - annotate - [select for diffs], Sun Apr 15 11:15:08 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)

minor indentation.

Revision 1.46 / (download) - annotate - [select for diffs], Fri Apr 13 18:57:49 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.45: +31 -21 lines
Diff to previous 1.45 (colored)

While splitting flags and pqflags might have been a good idea in theory
to separate locking, on most modern machines this is not enough
since operations on short types touch other short types that share the
same word in memory.

Merge pg_flags and pqflags again and now use atomic operations to change
the flags. Also bump wire_count to an int and pg_version might go
int as well, just for alignment.

tested by many, many. ok miod@

Revision 1.45 / (download) - annotate - [select for diffs], Wed Apr 11 12:10:42 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.44: +7 -25 lines
Diff to previous 1.44 (colored)

Instead of managing pages for intrsafe maps in special objects (aka.
kmem_object) just so that we can remove them, just use pmap_extract
to get the pages to free and simplify a lot of code to not deal with
the list of intrsafe maps, intrsafe objects, etc.

miod@ ok

Revision 1.44 / (download) - annotate - [select for diffs], Wed Apr 4 17:44:45 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.43: +31 -31 lines
Diff to previous 1.43 (colored)

Mechanically rename the "flags" and "version" fields in struct vm_page
to "pg_flags" and "pg_version", so that they are a bit easier to work with.
Whoever uses generic names like this for a popular struct obviously doesn't
read much code.

Most architectures compile and there are no functionality changes.

deraadt@ ok ("if something fails to compile, we fix that by hand")

Revision 1.43 / (download) - annotate - [select for diffs], Mon Mar 26 08:43:34 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.42: +14 -14 lines
Diff to previous 1.42 (colored)

Rip out the KERN_ error codes.
ok otto@

Revision 1.42 / (download) - annotate - [select for diffs], Sun Mar 25 11:31:07 2007 UTC (17 years, 2 months ago) by art
Branch: MAIN
Changes since 1.41: +7 -7 lines
Diff to previous 1.41 (colored)

remove KERN_SUCCESS and use 0 instead.
eyeballed by miod@ and pedro@

Revision 1.41 / (download) - annotate - [select for diffs], Mon Jul 31 11:51:29 2006 UTC (17 years, 10 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.40: +8 -8 lines
Diff to previous 1.40 (colored)

fix uvmhist #2: args are always u_long so fix missing %d and %x and no %ll; no change for normal code

Revision 1.40 / (download) - annotate - [select for diffs], Wed Jul 26 23:15:55 2006 UTC (17 years, 10 months ago) by mickey
Branch: MAIN
Changes since 1.39: +13 -13 lines
Diff to previous 1.39 (colored)

fix fmts for UVMHIST_LOG() entries making it more useful on 64bit archs; miod@ ok

Revision 1.39 / (download) - annotate - [select for diffs], Thu Jul 13 22:51:26 2006 UTC (17 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.38: +19 -19 lines
Diff to previous 1.38 (colored)

Back out the anon change.  Apparently it was tested by a few, but most of
us did not see it or get a chance to test it before it was commited. It
broke cvs, in the ami driver, making it not succeed at seeing it's devices.

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jun 21 16:20:05 2006 UTC (17 years, 11 months ago) by mickey
Branch: MAIN
Changes since 1.37: +20 -20 lines
Diff to previous 1.37 (colored)

from netbsd: make anons dynamically allocated from pool.
this results in lesse kva waste due to static preallocation of those
for every phys page and also every swap page.
tested by beck krw miod

Revision 1.37 / (download) - annotate - [select for diffs], Mon Mar 6 14:27:29 2006 UTC (18 years, 3 months ago) by mickey
Branch: MAIN
Changes since 1.36: +4 -7 lines
Diff to previous 1.36 (colored)

do not panic unwiring unmapped memory (mmap3 regress); from netbsd; kettenis@ tedu@ ok

Revision 1.36 / (download) - annotate - [select for diffs], Tue Nov 29 05:37:14 2005 UTC (18 years, 6 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.35: +3 -2 lines
Diff to previous 1.35 (colored)

apply patch from david hill for two netbsd prs:
14060 skip MADV_SEQUENTIAL if refaulting
18037 missing pageactivate
tested for some time by jolan krw

Revision 1.35 / (download) - annotate - [select for diffs], Sun Oct 23 01:42:22 2005 UTC (18 years, 7 months ago) by pedro
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

typo

Revision 1.34 / (download) - annotate - [select for diffs], Tue May 3 11:52:35 2005 UTC (19 years, 1 month ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.33: +7 -7 lines
Diff to previous 1.33 (colored)

repair file mmapings above 4g; found by chefren; art@ ok

Revision 1.33 / (download) - annotate - [select for diffs], Tue Aug 3 12:10:48 2004 UTC (19 years, 10 months ago) by todd
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.32: +2 -2 lines
Diff to previous 1.32 (colored)

the rest of the '#if DIAGNOSTIC' -> '#ifdef DIAGNOSTIC' in the kernel; ok miod@

Revision 1.4.4.9 / (download) - annotate - [select for diffs], Sat Jun 5 23:13:12 2004 UTC (20 years ago) by niklas
Branch: SMP
Changes since 1.4.4.8: +4 -0 lines
Diff to previous 1.4.4.8 (colored) to branchpoint 1.4 (colored) next main 1.5 (colored)

Merge with the trunk

Revision 1.32 / (download) - annotate - [select for diffs], Mon Feb 23 06:19:32 2004 UTC (20 years, 3 months ago) by drahn
Branch: MAIN
CVS Tags: SMP_SYNC_B, SMP_SYNC_A, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.31: +5 -1 lines
Diff to previous 1.31 (colored)

sync of pmap_update() calls with NetBSD. pmap_update is defined away on
all architectures but arm, where it is needed.

Revision 1.28.2.4 / (download) - annotate - [select for diffs], Mon Nov 4 18:02:32 2002 UTC (21 years, 7 months ago) by art
Branch: UBC
Changes since 1.28.2.3: +62 -32 lines
Diff to previous 1.28.2.3 (colored) to branchpoint 1.28 (colored) next main 1.29 (colored)

Huge sync to NetBSD plus lots of bugfixes.
 - uvm is as in netbsd-current minus uvm_map forward merge.
 - various locking bugfixes in nfs.
 - make sure that all specops and fifoops are correct in all vnodeop vectors.
 - make the filesystem code more like filsystem code and less like vm code.

Revision 1.28.2.3 / (download) - annotate - [select for diffs], Tue Jun 11 03:33:03 2002 UTC (22 years ago) by art
Branch: UBC
Changes since 1.28.2.2: +3 -3 lines
Diff to previous 1.28.2.2 (colored) to branchpoint 1.28 (colored)

Sync UBC branch to -current

Revision 1.4.4.8 / (download) - annotate - [select for diffs], Thu Mar 28 14:54:26 2002 UTC (22 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.4.4.7: +2 -2 lines
Diff to previous 1.4.4.7 (colored) to branchpoint 1.4 (colored)

Merge in -current from roughly a week ago

Revision 1.31 / (download) - annotate - [select for diffs], Thu Mar 14 01:27:18 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: UBC_SYNC_B, UBC_SYNC_A, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

First round of __P removal in sys

Revision 1.4.4.7 / (download) - annotate - [select for diffs], Wed Mar 6 02:17:14 2002 UTC (22 years, 3 months ago) by niklas
Branch: SMP
Changes since 1.4.4.6: +171 -176 lines
Diff to previous 1.4.4.6 (colored) to branchpoint 1.4 (colored)

Merge in trunk

Revision 1.28.2.2 / (download) - annotate - [select for diffs], Sat Feb 2 03:28:26 2002 UTC (22 years, 4 months ago) by art
Branch: UBC
Changes since 1.28.2.1: +95 -143 lines
Diff to previous 1.28.2.1 (colored) to branchpoint 1.28 (colored)

Merge in UBC performance changes from NetBSD.
Fix a bunch of merge errors from yesterday.

Revision 1.28.2.1 / (download) - annotate - [select for diffs], Thu Jan 31 22:55:51 2002 UTC (22 years, 4 months ago) by niklas
Branch: UBC
Changes since 1.28: +11 -33 lines
Diff to previous 1.28 (colored)

Merge in -current, builds on i386, otherwise untested

Revision 1.30 / (download) - annotate - [select for diffs], Wed Jan 2 22:23:25 2002 UTC (22 years, 5 months ago) by miod
Branch: MAIN
Changes since 1.29: +21 -41 lines
Diff to previous 1.29 (colored)

Back out a few more uvm changes, especially wrt swap usage.
This unbreaks m68k m88k sparc and perhaps others, which eventually froze
when hitting swap.
Tested by various people on various platforms.
ok art@

Revision 1.29 / (download) - annotate - [select for diffs], Wed Dec 19 08:58:07 2001 UTC (22 years, 5 months ago) by art
Branch: MAIN
Changes since 1.28: +156 -141 lines
Diff to previous 1.28 (colored)

UBC was a disaster. It worked very good when it worked, but on some
machines or some configurations or in some phase of the moon (we actually
don't know when or why) files disappeared. Since we've not been able to
track down the problem in two weeks intense debugging and we need -current
to be stable, back out everything to a state it had before UBC.

We apologise for the inconvenience.

Revision 1.4.4.6 / (download) - annotate - [select for diffs], Wed Dec 5 01:23:58 2001 UTC (22 years, 6 months ago) by niklas
Branch: SMP
Changes since 1.4.4.5: +140 -155 lines
Diff to previous 1.4.4.5 (colored) to branchpoint 1.4 (colored)

Merge in -current

Revision 1.28 / (download) - annotate - [select for diffs], Tue Dec 4 23:22:42 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
CVS Tags: UBC_BASE
Branch point for: UBC
Changes since 1.27: +6 -6 lines
Diff to previous 1.27 (colored)

Yet another sync to NetBSD uvm.
Today we add a pmap argument to pmap_update() and allocate map entries for
kernel_map from kmem_map instead of using the static entries. This should
get rid of MAX_KMAPENT panics. Also some uvm_loan problems are fixed.

Revision 1.27 / (download) - annotate - [select for diffs], Wed Nov 28 19:28:14 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
Changes since 1.26: +96 -86 lines
Diff to previous 1.26 (colored)

Sync in more uvm from NetBSD. Mostly just cosmetic stuff.
Contains also support for page coloring.

Revision 1.26 / (download) - annotate - [select for diffs], Wed Nov 28 13:47:39 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
Changes since 1.25: +50 -71 lines
Diff to previous 1.25 (colored)

Sync in more uvm changes from NetBSD.
This time we're getting rid of KERN_* and VM_PAGER_* error codes and
use errnos instead.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Nov 27 05:27:12 2001 UTC (22 years, 6 months ago) by art
Branch: MAIN
Changes since 1.24: +1 -5 lines
Diff to previous 1.24 (colored)

Merge in the unified buffer cache code as found in NetBSD 2001/03/10. The
code is written mostly by Chuck Silvers <chuq@chuq.com>/<chs@netbsd.org>.

Tested for the past few weeks by many developers, should be in a pretty stable
state, but will require optimizations and additional cleanups.

Revision 1.4.4.5 / (download) - annotate - [select for diffs], Tue Nov 13 23:02:31 2001 UTC (22 years, 7 months ago) by niklas
Branch: SMP
Changes since 1.4.4.4: +119 -145 lines
Diff to previous 1.4.4.4 (colored) to branchpoint 1.4 (colored)

merge in -current

Revision 1.24 / (download) - annotate - [select for diffs], Mon Nov 12 01:26:09 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.23: +58 -39 lines
Diff to previous 1.23 (colored)

Bring in more changes from NetBSD. Mostly pagedaemon improvements.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Nov 9 04:34:27 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.22: +52 -102 lines
Diff to previous 1.22 (colored)

various style fixes.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Nov 6 13:36:52 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.21: +22 -14 lines
Diff to previous 1.21 (colored)

More sync to NetBSD.
 - Use malloc/free instead of MALLOC/FREE for variable sized allocations.
 - Move the memory inheritance code to sys/mman.h and rename from VM_* to MAP_*
 - various cleanups and simplifications.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Nov 6 01:35:04 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.20: +2 -5 lines
Diff to previous 1.20 (colored)

Move the last content from vm/ to uvm/
The only thing left in vm/ are just dumb wrappers.
vm/vm.h includes uvm/uvm_extern.h
vm/pmap.h includes uvm/uvm_pmap.h
vm/vm_page.h includes uvm/uvm_page.h

Revision 1.20 / (download) - annotate - [select for diffs], Mon Nov 5 22:14:54 2001 UTC (22 years, 7 months ago) by art
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Minor sync to NetBSD.

Revision 1.4.4.4 / (download) - annotate - [select for diffs], Wed Oct 31 03:32:14 2001 UTC (22 years, 7 months ago) by nate
Branch: SMP
Changes since 1.4.4.3: +148 -48 lines
Diff to previous 1.4.4.3 (colored) to branchpoint 1.4 (colored)

Sync the SMP branch to something just after 3.0

Revision 1.19 / (download) - annotate - [select for diffs], Wed Sep 19 20:50:59 2001 UTC (22 years, 8 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.18: +1 -2 lines
Diff to previous 1.18 (colored)

merge vm/vm_kern.h into uvm/uvm_extern.h; art@ ok

Revision 1.18 / (download) - annotate - [select for diffs], Sat Aug 11 10:57:22 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.17: +16 -5 lines
Diff to previous 1.17 (colored)

Various random fixes from NetBSD.
Including support for zeroing pages in the idle loop (not enabled yet).

Revision 1.17 / (download) - annotate - [select for diffs], Thu Jul 26 19:37:13 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.16: +34 -15 lines
Diff to previous 1.16 (colored)

Add support for disabling swap devices (swapctl -d).
Improve error handling on I/O errors to swap.
From NetBSD

Revision 1.16 / (download) - annotate - [select for diffs], Wed Jul 25 13:25:33 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.15: +96 -21 lines
Diff to previous 1.15 (colored)

Change the pmap_enter interface to merge access_type and the wired boolean
and arbitrary flags into one argument.

One new flag is PMAP_CANFAIL that tells pmap_enter that it can fail if there
are not enough resources to satisfy the request. If this flag is not passed,
pmap_enter should panic as it should have done before this change (XXX - many
pmaps are still not doing that).

Only i386 and alpha implement CANFAIL for now.

Includes uvm updates from NetBSD.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jul 18 10:47:05 2001 UTC (22 years, 10 months ago) by art
Branch: MAIN
Changes since 1.14: +9 -13 lines
Diff to previous 1.14 (colored)

Get rid of the PMAP_NEW option by making it mandatory for all archs.
The archs that didn't have a proper PMAP_NEW now have a dummy implementation
with wrappers around the old functions.

Revision 1.4.4.3 / (download) - annotate - [select for diffs], Wed Jul 4 11:01:02 2001 UTC (22 years, 11 months ago) by niklas
Branch: SMP
Changes since 1.4.4.2: +64 -37 lines
Diff to previous 1.4.4.2 (colored) to branchpoint 1.4 (colored)

Merge in -current from two days ago in the SMP branch.
As usual with merges, they do not indicate progress, so do not hold
your breath for working SMP, and do not mail me and ask about the
state of it.  It has not changed.  There is work ongoing, but very, very
slowly.  The commit is done in parts as to not lock up the tree in too
big chunks at a time.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jun 23 19:24:33 2001 UTC (22 years, 11 months ago) by smart
Branch: MAIN
Changes since 1.13: +5 -5 lines
Diff to previous 1.13 (colored)

Sync with NetBSD 19990911 (just before PMAP_NEW was required)
  - thread_sleep_msg() -> uvm_sleep()
  - initialize reference count lock in uvm_anon_{init,add}()
  - add uao_flush()
  - replace boolean 'islocked' with 'lockflags'
  - in uvm_fault() change FALSE to TRUE to in 'wide' fault handling
  - get rid of uvm_km_get()
  - various bug fixes

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jun 8 08:09:38 2001 UTC (23 years ago) by art
Branch: MAIN
Changes since 1.12: +5 -10 lines
Diff to previous 1.12 (colored)

Change the paddr_t pmap_extract(struct pmap *, vaddr_t) interface to
boolean_t pmap_extract(struct pmap *, vaddr_t, paddr_t *).
Matches NetBSD. Tested by various people on various platforms.

Revision 1.4.4.2 / (download) - annotate - [select for diffs], Mon May 14 22:47:45 2001 UTC (23 years, 1 month ago) by niklas
Branch: SMP
Changes since 1.4.4.1: +21 -16 lines
Diff to previous 1.4.4.1 (colored) to branchpoint 1.4 (colored)

merge in approximately 2.9 into SMP branch

Revision 1.12 / (download) - annotate - [select for diffs], Wed May 9 15:31:23 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.11: +4 -22 lines
Diff to previous 1.11 (colored)

More sync to NetBSD.

 - Change pmap_change_wiring to pmap_unwire because it's only called that way.
 - Remove pmap_pageable because it's seldom implemented and when it is, it's
   either almost useless or incorrect. The same information is already passed
   to the pmap anyway by pmap_enter and pmap_unwire.

Revision 1.11 / (download) - annotate - [select for diffs], Mon May 7 16:08:40 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.10: +59 -9 lines
Diff to previous 1.10 (colored)

Few fixes from NetBSD.
 - make sure that vsunlock doesn't unwire mlocked memory.
 - fix locking in uvm_useracc.
 - Return the error uvm_fault_wire in uvm_vslock (will be used soon).

Revision 1.10 / (download) - annotate - [select for diffs], Thu Mar 22 23:36:52 2001 UTC (23 years, 2 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.9: +9 -4 lines
Diff to previous 1.9 (colored)

Merge in NetBSD's PMAP_NEW, still disabled

Revision 1.9 / (download) - annotate - [select for diffs], Thu Mar 22 03:05:55 2001 UTC (23 years, 2 months ago) by smart
Branch: MAIN
Changes since 1.8: +2 -2 lines
Diff to previous 1.8 (colored)

Sync style, typo, and comments a little closer to NetBSD.  art@ ok

Revision 1.8 / (download) - annotate - [select for diffs], Fri Mar 9 14:20:51 2001 UTC (23 years, 3 months ago) by art
Branch: MAIN
Changes since 1.7: +5 -6 lines
Diff to previous 1.7 (colored)

More syncing to NetBSD.

Implements mincore(2), mlockall(2) and munlockall(2). mlockall and munlockall
are disabled for the moment.

The rest is mostly cosmetic.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Mar 8 15:21:36 2001 UTC (23 years, 3 months ago) by smart
Branch: MAIN
Changes since 1.6: +8 -8 lines
Diff to previous 1.6 (colored)

Replace thread_wakeup() with wakeup().  It is defined in vm_extern.h as a
wrapper, so this removes a dependence on the old VM system.  From NetBSD.
art@ ok

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jan 29 02:07:44 2001 UTC (23 years, 4 months ago) by niklas
Branch: MAIN
Changes since 1.5: +1 -0 lines
Diff to previous 1.5 (colored)

$OpenBSD$

Revision 1.4.4.1 / (download) - annotate - [select for diffs], Fri Mar 24 09:09:49 2000 UTC (24 years, 2 months ago) by niklas
Branch: SMP
Changes since 1.4: +37 -8 lines
Diff to previous 1.4 (colored)

Sync with -current

Revision 1.5 / (download) - annotate - [select for diffs], Thu Mar 16 22:11:04 2000 UTC (24 years, 3 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.4: +37 -8 lines
Diff to previous 1.4 (colored)

Bring in some new UVM code from NetBSD (not current).

 - Introduce a new type of map that are interrupt safe and never allow faults
   in them. mb_map and kmem_map are made intrsafe.
 - Add "access protection" to uvm_vslock (to be passed down to uvm_fault and
   later to pmap_enter).
 - madvise(2) now works.
 - various cleanups.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Sep 3 18:02:21 1999 UTC (24 years, 9 months ago) by art
Branch: MAIN
CVS Tags: kame_19991208, SMP_BASE, OPENBSD_2_6_BASE, OPENBSD_2_6
Branch point for: SMP
Changes since 1.3: +4 -4 lines
Diff to previous 1.3 (colored)

Change the pmap_enter api to pass down an argument that indicates
the access type that caused this mapping. This is to simplify pmaps
with mod/ref emulation (none for the moment) and in some cases speed
up pmap_is_{referenced,modified}.
At the same time, clean up some mappings that had too high protection.

XXX - the access type is incorrect in old vm, it's only used by uvm and MD code.
The actual use of this in pmap_enter implementations is not in this commit.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Aug 23 08:13:23 1999 UTC (24 years, 9 months ago) by art
Branch: MAIN
Changes since 1.2: +54 -28 lines
Diff to previous 1.2 (colored)

sync with NetBSD from 1999.05.24 (there is a reason for this date)
 Mostly cleanups, but also a few improvements to pagedaemon for better
 handling of low memory and/or low swap conditions.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Feb 26 05:32:06 1999 UTC (25 years, 3 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.1: +1 -0 lines
Diff to previous 1.1 (colored)

add OpenBSD tags

Revision 1.1 / (download) - annotate - [select for diffs], Fri Feb 26 01:30:12 1999 UTC (25 years, 3 months ago) by art
Branch: MAIN

Import of uvm from NetBSD. Some local changes, some code disabled

This form allows you to request diff's 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.