History log of /openbsd-current/sys/uvm/uvm_page.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.71 13-May-2024 jsg

remove prototypes with no matching function
ok mpi@


# 1.70 12-May-2024 jsg

vm_page_zero_enable was removed in 2015


Revision tags: OPENBSD_7_2_BASE OPENBSD_7_3_BASE OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.69 01-Aug-2022 mpi

Introduce and use uvm_pagewait() where PG_WANTED is set.

No change in behavior.

ok kn@, semarie@, kettenis@


# 1.68 12-May-2022 mpi

Introduce uvm_pagedequeue() to reduce code duplication.

ok kettenis@


Revision tags: OPENBSD_7_1_BASE
# 1.67 29-Jan-2022 aoyama

Fix macro name in comment.

ok visa@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.66 26-Mar-2021 mpi

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

No functional change.

ok mlarkin@


Revision tags: OPENBSD_6_8_BASE
# 1.65 22-Sep-2020 mpi

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@


Revision tags: OPENBSD_6_7_BASE
# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


# 1.69 01-Aug-2022 mpi

Introduce and use uvm_pagewait() where PG_WANTED is set.

No change in behavior.

ok kn@, semarie@, kettenis@


# 1.68 12-May-2022 mpi

Introduce uvm_pagedequeue() to reduce code duplication.

ok kettenis@


Revision tags: OPENBSD_7_1_BASE
# 1.67 29-Jan-2022 aoyama

Fix macro name in comment.

ok visa@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.66 26-Mar-2021 mpi

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

No functional change.

ok mlarkin@


Revision tags: OPENBSD_6_8_BASE
# 1.65 22-Sep-2020 mpi

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@


Revision tags: OPENBSD_6_7_BASE
# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


# 1.68 12-May-2022 mpi

Introduce uvm_pagedequeue() to reduce code duplication.

ok kettenis@


Revision tags: OPENBSD_7_1_BASE
# 1.67 29-Jan-2022 aoyama

Fix macro name in comment.

ok visa@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.66 26-Mar-2021 mpi

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

No functional change.

ok mlarkin@


Revision tags: OPENBSD_6_8_BASE
# 1.65 22-Sep-2020 mpi

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@


Revision tags: OPENBSD_6_7_BASE
# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


# 1.67 29-Jan-2022 aoyama

Fix macro name in comment.

ok visa@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.66 26-Mar-2021 mpi

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

No functional change.

ok mlarkin@


Revision tags: OPENBSD_6_8_BASE
# 1.65 22-Sep-2020 mpi

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@


Revision tags: OPENBSD_6_7_BASE
# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


# 1.66 26-Mar-2021 mpi

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

No functional change.

ok mlarkin@


Revision tags: OPENBSD_6_8_BASE
# 1.65 22-Sep-2020 mpi

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@


Revision tags: OPENBSD_6_7_BASE
# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


# 1.65 22-Sep-2020 mpi

Spell inline correctly.

Reduce differences with NetBSD.

ok mvs@, kettenis@


Revision tags: OPENBSD_6_7_BASE
# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


# 1.64 29-Nov-2019 kettenis

Split out the code that removes a page from uvm objects and clears the flags
into a separate uvm_pageclean() function and call it from uvm_pagefree().

ok mpi@, guenther@, beck@


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.63 07-Nov-2016 guenther

Split PID from TID, giving processes a PID unrelated to the TID of their
initial thread

ok jsing@ kettenis@


# 1.62 16-Sep-2016 dlg

move the vm_page struct from being stored in RB macro trees to RBT functions

vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and
uvm_pmr_size. all these have been moved to RBT code.

this should give us a decent chunk of code space back.


Revision tags: OPENBSD_6_0_BASE
# 1.61 09-Mar-2016 deraadt

remove vaxisms


Revision tags: OPENBSD_5_9_BASE
# 1.60 08-Oct-2015 kettenis

Lock the page queues by turning uvm_lock_pageq() and uvm_unlock_pageq() into
mtx_enter() and mtx_leave() operations. Not 100% this won't blow up but
there is only one way to find out, and we need this to make progress on
further unlocking uvm.

prodded by deraadt@


# 1.59 21-Aug-2015 visa

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 tags: OPENBSD_5_8_BASE
# 1.58 22-Apr-2015 dlg

having macros provide semicolons is dangerous.


Revision tags: OPENBSD_5_7_BASE
# 1.57 07-Feb-2015 kettenis

Tedu the old idle page zeroing code.

ok tedu@, guenther@, miod@


# 1.56 05-Feb-2015 mpi

Remove some unneeded <uvm/uvm_extern.h> inclusions.

ok deraadt@, miod@


# 1.55 03-Oct-2014 kettenis

Introduce a thread for zeroing pages without holding the kernel lock. This
way we can do some useful kernel lock in parallel with other things and create
a reservoir of zeroed pages ready for use elsewhere. This should reduce
latency. The thread runs at the absolutel lowest priority such that we don't
keep other kernel threads or userland from doing useful work.

Can be easily disabled by disabling the kthread_create(9) call in main().
Which perhaps we should do for non-MP kernels.

ok deraadt@, tedu@


Revision tags: OPENBSD_5_6_BASE
# 1.54 11-Jul-2014 jsg

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


# 1.53 21-Mar-2014 miod

Allow for two more pmap-specific bits in vm_page pg_flags. Define
PG_PMAPMASK as all the possible pmap-specific bits (similar to the other
PG_fooMASK) to make sure MI code does not need to be updated, the next time
more bits are allocated to greedy pmaps.

No functional change, soon to be used by the (greedy) mips64 pmap.


Revision tags: OPENBSD_5_5_BASE
# 1.52 23-Jan-2014 miod

unifdef -D__HAVE_VM_PAGE_MD - no functional change.


# 1.51 01-Jan-2014 miod

Remove __HAVE_PMAP_PHYSSEG support, nothing uses it anymore.


Revision tags: OPENBSD_5_4_BASE
# 1.50 30-May-2013 tedu

remove lots of comments about locking per beck's request


# 1.49 30-May-2013 tedu

remove simple_locks from uvm code. ok beck deraadt


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE
# 1.48 30-May-2011 oga

Remove the freelist member from vm_physseg

The new world order of pmemrange makes this data completely redundant
(being dealt with by the pmemrange constraints instead). Remove all code
that messes with the freelist.

While touching every caller of uvm_page_physload() anyway, add the flags
argument to all callers (all but one is 0 and that one already used
PHYSLOAD_DEVICE) and remove the macro magic to allow callers to continue
without it.

Should shrink the code a bit, as well.

matthew@ pointed out some mistakes i'd made.
``freelist death, I like. Ok.' ariane@
`I agree with the general direction, go ahead and i'll fix any fallout
shortly'' miod@ (68k 88k and vax i could not check would build)


# 1.47 10-May-2011 oga

Kill vm_page_lookup_freelist.

it belongs to a world order that isn't here anymore. More importantly it
has been unused for a fair while now.

ok thib@


# 1.46 07-May-2011 oga

So long, uvm_pglist.h

This header defined three thing. two of which are unused throughout the tree,
the final one was the definition of the pagq head type, move that to uvm_page.h
and nuke the header

ok thib@. Thanks to krw@ for testing the hppa build for me.


# 1.45 02-Apr-2011 ariane

Count the number of physical pages within a memory range.
Bob needs this.

ok art@ bob@ thib@


Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.44 29-Jun-2010 thib

Add PADDR_IS_DMA_REACHABLE macro so art stops whining


# 1.43 27-Jun-2010 thib

uvm constraints. Add two mandatory MD symbols, uvm_md_constraints
which contains the constraints for DMA/memory allocation for each
architecture, and dma_constraints which contains the range of addresses
that are dma accessable by the system.

This is based on ariane@'s physcontig diff, with lots of bugfixes and
additions the following additions by my self:

Introduce a new function pool_set_constraints() which sets the address
range for which we allocate pages for the pool from, this is now used
for the mbuf/mbuf cluster pools to keep them dma accessible.

The !direct archs no longer stuff pages into the kernel object in
uvm_km_getpage_pla but rather do a pmap_extract() in uvm_km_putpages.

Tested heavily by my self on i386, amd64 and sparc64. Some tests on
alpha and SGI.

"commit it" beck, art, oga, deraadt
"i like the diff" deraadt


# 1.42 22-Apr-2010 oga

Committing on behalf or ariane@.

recommit pmemrange:
physmem allocator: change the view of free memory from single
free pages to free ranges. Classify memory based on region with
associated use-counter (which is used to construct a priority
list of where to allocate memory).

Based on code from tedu@, help from many.

Useable now that bugs have been found and fixed in most architecture's
pmap.c

ok by everyone who has done a pmap or uvm commit in the last year.


# 1.41 24-Mar-2010 oga

Bring back PHYSLOAD_DEVICE for uvm_page_physload.

ok kettenis@ beck@ (tentatively) and ariane@. deraadt asked for it to be
commited now.

original commit message:

extend uvm_page_physload to have the ability to add "device" pages to
the system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@ kettenis@, beck@


Revision tags: OPENBSD_4_7_BASE
# 1.40 06-Aug-2009 oga

reintroduce the uvm_tree commit.

Now instead of the global object hashtable, we have a per object tree.

Testing shows no performance difference and a slight code shrink. OTOH when
locking is more fine grained this should be faster due to lock contention on
uvm.hashlock.

ok thib@, art@.


Revision tags: OPENBSD_4_6_BASE
# 1.39 17-Jun-2009 oga

date based reversion of uvm to the 4th May.

More backouts in line with previous ones, this appears to bring us back to a
stable condition.

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@


# 1.38 16-Jun-2009 ariane

Backout pmemrange (which to most people is more well known as physmem
allocator).

"i can't see any obvious problems" oga


# 1.37 16-Jun-2009 oga

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@.


# 1.36 14-Jun-2009 deraadt

backout:
> extend uvm_page_physload to have the ability to add "device" pages to the
> system.
since it was overlayed over a system that we warned would go "in to be
tested, but may be pulled out". oga, you just made me spend 20 minutes
of time I should not have had to spend doing this.


# 1.35 07-Jun-2009 oga

extend uvm_page_physload to have the ability to add "device" pages to the
system.

This is needed in the case where you need managed pages so you can
handle faulting and pmap_page_protect() on said pages when you manage
memory in such regions (i'm looking at you, graphics cards).

these pages are flagged PG_DEV, and shall never be on the freelists,
assert this. behaviour remains unchanged in the non-device case,
specifically for all archs currently in the tree we panic if called
after bootstrap.

ok art@, kettenis@, ariane@, beck@.


# 1.34 02-Jun-2009 oga

Instead of the global hash table with the terrible hashfunction and a
global lock, switch the uvm object pages to being kept in a per-object
RB_TREE. Right now this is approximately the same speed, but cleaner.
When biglock usage is reduced this will improve concurrency due to lock
contention..

ok beck@ art@. Thanks to jasper for the speed testing.


# 1.33 01-Jun-2009 ariane

physmem allocator: change the view of free memory from single free pages
to free ranges.
Classify memory based on region with associated use-counter (which is used
to construct a priority list of where to allocate memory).

Based on code from tedu@, help from many.
Ok art@


# 1.32 28-Apr-2009 miod

Revert pageqlock back from a mutex to a simple_lock, as it needs to be
recursive in some cases (mostly involving swapping). A proper fix is in
the works, but this will unbreak kernels for now.


# 1.31 13-Apr-2009 oga

Convert the page queue lock to a mutex instead of a simplelock.

Fix up the one case of lock recursion (which blatantly ignored the
comment right above it saying that we don't need to lock). The rest of
the lock usage has been checked and appears to be correct.

ok ariane@.


# 1.30 06-Apr-2009 oga

In the case where VM_PHYSSEG_MAX == 1 make vm_physseg_find and
PHYS_TO_VM_PAGE inline again. This should stop function call overhead
killing the vax and other slow archs while keeping the benefit for the
faster platforms.

suggested by miod. ok miod@, toby@.


# 1.29 25-Mar-2009 oga

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@.


# 1.28 24-Mar-2009 oga

vm_physseg_find and VM_PAGE_TO_PHYS are both called many times in your
average arch port. They are also inline. This does not help, de-inline them.

shaves about 1k on i386 and amd64 bsd.mp. Probably similar amounts of
most architectures.

"no issue" beck@ "Nuke nuke nuke... make them functions" weingart@ "this
is good" art@


Revision tags: OPENBSD_4_5_BASE
# 1.27 20-Jan-2009 ariane

Variables were never used, never implemented.

Ok miod, toby


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.26 18-Dec-2007 thib

Turn the uvm_{lock/unlock}_fpageq() inlines into
macros that just expand into the mutex functions
to keep the abstraction, do assorted cleanup.

ok miod@,art@


Revision tags: OPENBSD_4_2_BASE
# 1.25 18-Apr-2007 art

Reserve a few pg_flags for pmaps that might want to use them.
i386 will use them soon and miod wants to work on other pmaps in
parallell.

miod@ ok


# 1.24 13-Apr-2007 art

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@


# 1.23 04-Apr-2007 art

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 tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
# 1.22 16-Jun-2006 miod

IS_VM_PHYSADDR is no longer used.


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE SMP_SYNC_A SMP_SYNC_B
# 1.21 08-Nov-2003 jmc

typos from Jonathon Gray;


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.20 20-Jul-2002 art

Only add a pmap_physseg if MD code defines __HAVE_PMAP_PHYSSEG.


# 1.19 11-Jun-2002 art

Allow MD code to define __HAVE_VM_PAGE_MD to add own members into struct vm_page.
From NetBSD.


Revision tags: OPENBSD_3_1_BASE
# 1.18 14-Mar-2002 millert

First round of __P removal in sys


# 1.17 19-Dec-2001 art

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 tags: UBC_BASE
# 1.16 04-Dec-2001 art

branches: 1.16.2;
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.


# 1.15 30-Nov-2001 art

Now that pmaps can have vm_page_md, make pmap_physseg optional.


# 1.14 28-Nov-2001 art

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


# 1.13 12-Nov-2001 art

Bring in more changes from NetBSD. Mostly pagedaemon improvements.


# 1.12 10-Nov-2001 art

Merge in some parts of the ubc work that has been done in NetBSD that are not
UBC, but prerequsites for it.

- Create a daemon that processes async I/O (swap and paging in the future)
requests that need processing in process context and that were processed
in the pagedaemon before.
- Convert some ugly ifdef DIAGNOSTIC code to less intrusive KASSERTs.
- misc other cleanups.


# 1.11 07-Nov-2001 art

Another sync of uvm to NetBSD. Just minor fiddling, no major changes.


# 1.10 06-Nov-2001 art

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 tags: OPENBSD_3_0_BASE
# 1.9 11-Aug-2001 art

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


# 1.8 06-Aug-2001 art

Add a new type voff_t (right now it's typedefed as off_t) used for offsets
into objects.

Gives the possibilty to mmap beyond the size of vaddr_t.

From NetBSD.


Revision tags: OPENBSD_2_9_BASE
# 1.7 22-Mar-2001 smart

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


# 1.6 09-Mar-2001 smart

Protect protypes, certain macros, and inlines from userland. Checked userland
with a 'make build'. From NetBSD. art@ ok


# 1.5 29-Jan-2001 niklas

$OpenBSD$


Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE
# 1.4 16-Mar-2000 art

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 tags: OPENBSD_2_6_BASE SMP_BASE kame_19991208
# 1.3 23-Aug-1999 art

branches: 1.3.4;
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 tags: OPENBSD_2_5_BASE
# 1.2 26-Feb-1999 art

add OpenBSD tags


# 1.1 26-Feb-1999 art

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