Home | History | Annotate | Download | only in uvm
History log of /src/sys/uvm/uvm_bio.c
RevisionDateAuthorComments
 1.128  09-Apr-2023  riastradh uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B)
 1.127  12-Feb-2023  andvar s/strucure/structure/ and s/structues/structures/ in comments.
 1.126  01-Apr-2021  simonb Add a sysctl hashstat collector for ubchash.
 1.125  13-Mar-2021  skrll branches: 1.125.2;
Consistently use %#jx instead of 0x%jx or just %jx in UVMHIST_LOG formats
 1.124  10-Nov-2020  chs remove someone's leftover debug printfs.
 1.123  18-Oct-2020  rin branches: 1.123.2;
PR kern/55658

Revert rev 1.122:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/uvm/uvm_bio.c#rev1.122

If this commit is applied to NFS client, changes to files in client
side are sometimes invisible in server side, which results in file
corruption.

Demonstrated by test code provided by Anthony Mallet:
https://mail-index.netbsd.org/current-users/2020/10/17/msg039708.html

Whether the test case above passes or not depends on architectures
and size of NFS I/O specified by -r and -w options of mount_nfs(8)
(the default size is 32KB for x86 and 8KB for other archs).

Whereas it fails on amd64 and i386 with the default size, it passes
on other archs (aarch64, arm, alpha, m68k, and powerpc at least) with
their default. On most ports, it fails with some I/O sizes.

However, the condition for failure is still unclear; whereas it fails
with 2KB I/O size on amiga (m68k, 8KB page), it passes with same I/O
size on alpha (8KB page). It may depends on some VM parameters or
details in pmap implementation, or some race conditions are involved.

Great thanks to Anthony Mallet for providing the test code, and sorry
everyone for breakage.
 1.122  05-Oct-2020  rin PR kern/55658

ubc_fault_page(): Ignore PG_RDONLY flag and always pmap_enter() the page
with the permissions of the original access_type.

It is the file system's responsibility to allocate blocks that is being
modified by write(), before calling into UBC to fill the pages for that
range. KASSERT() is added there to confirm that no clean page is mapped
writable.

Fix infinite loop in uvm_fault_internal(), observed on 16KB-page systems,
where it continues to try to make a partially-backed page writable.

No regression in ATF and KASSERT() does not fire on several architectures,
as far as I can see.

Fix suggested by chs. Thanks!
 1.121  09-Jul-2020  rin PR kern/55467
tmpfs calls pmap_kenter_pa(9) with virtual address with page offset

Bisectioning revealed that the failure starts with this commit:

sys/fs/tmpfs/tmpfs_vnops.c rev 1.142:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/fs/tmpfs/tmpfs_vnops.c#rev1.142

by which tmpfs became to use UBC_FAULTBUSY flag for ubc_uiomove(9).
If this flag is specified, pmap_kenter_pa(9) is called with virtual
address with page offset via ubc_alloc(9):

https://nxr.netbsd.org/xref/src/sys/uvm/uvm_bio.c#616

Most ports seem to neglect silently page offset of va argument for
pmap_kenter_pa(9). However, it causes KASSERT failure correctly for
powerpc/booke. So, truncate page offset there.

Now, tmpfs works just fine on evbppc-booke, and I've confirmed that
no new failures are detected by ATF.

Discussed with chs@. Thanks!
 1.120  09-Jul-2020  skrll Consistently use UVMHIST(__func__)

Convert UVMHIST_{CALLED,LOG} into UVMHIST_CALLARGS
 1.119  08-Jul-2020  skrll Trailing whitespace
 1.118  25-Jun-2020  jdolecek make ubc_winshift / ubc_winsize constant, and based on whatever is bigger
of (1 << UBC_WINSHIFT, MAX_PAGE_SIZE)

given that default UBC_WINSHIFT is 13, this changes behaviour only
for mips and powerpc (BookE/OEA), which will now have twice as much
memory used for UBC windows; if this ever becomes a problem, it's
possible to reduce ubc_nwins in MD code similar to what is done on sparc

this eliminates variable-length arrays in ubc_fault(),
ubc_uiomove(), and ubc_zerorange() so that the stack usage can be
determined and checked in compile time
 1.117  25-May-2020  ad ubc_uiomove_direct(): if UBC_FAULTBUSY, the left-over portion of the final
page needs to be zeroed.
 1.116  24-May-2020  ad - ubc_uiomove(): Always use direct access in the UBC_FAULTBUSY case, since
it works basically the same way as !direct minus temporary mappings, and
there are no concurrency issues.

- ubc_alloc_direct(): In the PGO_OVERWRITE case blocks are allocated
beforehand. Avoid waking or activating pages unless needed.
 1.115  23-May-2020  ad - In ubc_alloc() take initial offset into account in the UBC_FAULTBUSY case
or one too few pages can be mapped.

- In ubc_release() with UBC_FAULTBUSY, chances are that pages are newly
allocated and freshly enqueued, so avoid uvm_pageactivate() if possible

- Keep track of the pages mapped in ubc_alloc() in an array on the stack,
and use this to avoid calling pmap_extract() in ubc_release().
 1.114  19-May-2020  ad PR kern/32166: pgo_get protocol is ambiguous
Also problems with tmpfs+nfs noted by hannken@.

Don't pass PGO_ALLPAGES to pgo_get, and ignore PGO_DONTCARE in the
!PGO_LOCKED case. In uao_get() have uvm_pagealloc() take care of page
zeroing and release busy pages on error.
 1.113  26-Apr-2020  thorpej Disable ubc_direct by default again. There are still stability issues
(e.g. panic during 2020.04.25.00.07.27 amd64 releng test run).
 1.112  24-Apr-2020  ad ubc_alloc_direct(): for a write make sure pages are always marked dirty
because there's no managed mapping.
 1.111  23-Apr-2020  ad Enable ubc_direct by default, but only on systems with no more than 2 CPUs
for now.
 1.110  23-Apr-2020  ad PR kern/54759 (vm.ubc_direct deadlock when read()/write() into mapping of itself)

- Add new flag UBC_ISMAPPED which tells ubc_uiomove() the object is mmap()ed
somewhere. Use it to decide whether to do direct-mapped copy, rather than
poking around directly in the vnode in ubc_uiomove(), which is ugly and
doesn't work for tmpfs. It would be nicer to contain all this in UVM but
the filesystem provides the needed locking here (VV_MAPPED) and to
reinvent that would suck more.

- Rename UBC_UNMAP_FLAG() to UBC_VNODE_FLAGS(). Pass in UBC_ISMAPPED where
appropriate.
 1.109  23-Apr-2020  ad ubc_direct_release(): unbusy the pages directly since pg->interlock is
being taken.
 1.108  07-Apr-2020  ad branches: 1.108.2;
ubc_direct_release(): remove spurious call to uvm_pagemarkdirty().
 1.107  07-Apr-2020  ad PR kern/54759: vm.ubc_direct deadlock when read()/write() into mapping of itself

Prevent ubc_uiomove_direct() on mapped vnodes.
 1.106  17-Mar-2020  ad Tweak the March 14th change to make page waits interlocked by pg->interlock.
Remove unneeded changes and only deal with the PQ_WANTED flag, to exclude
possible bugs.
 1.105  14-Mar-2020  ad Make page waits (WANTED vs BUSY) interlocked by pg->interlock. Gets RW
locks out of the equation for sleep/wakeup, and allows observing+waiting
for busy pages when holding only a read lock. Proposed on tech-kern.
 1.104  23-Feb-2020  ad UVM locking changes, proposed on tech-kern:

- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart. v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap. Others to follow later.
 1.103  15-Jan-2020  ad Merge from yamt-pagecache (after much testing):

- Reduce unnecessary page scan in putpages esp. when an object has a ton of
pages cached but only a few of them are dirty.

- Reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
 1.102  31-Dec-2019  ad branches: 1.102.2;
- Add and use wrapper functions that take and acquire page interlocks, and pairs
of page interlocks. Require that the page interlock be held over calls to
uvm_pageactivate(), uvm_pagewire() and similar.

- Solve the concurrency problem with page replacement state. Rather than
updating the global state synchronously, set an intended state on
individual pages (active, inactive, enqueued, dequeued) while holding the
page interlock. After the interlock is released put the pages on a 128
entry per-CPU queue for their state changes to be made real in batch.
This results in in a ~400 fold decrease in contention on my test system.
Proposed on tech-kern but modified to use the page interlock rather than
atomics to synchronise as it's much easier to maintain that way, and
cheaper.
 1.101  13-Dec-2019  ad Break the global uvm_pageqlock into a per-page identity lock and a private
lock for use of the pagedaemon policy code. Discussed on tech-kern.

PR kern/54209: NetBSD 8 large memory performance extremely low
PR kern/54210: NetBSD-8 processes presumably not exiting
PR kern/54727: writing a large file causes unreasonable system behaviour
 1.100  07-Nov-2019  skrll Fix a UVMHIST_LOG format broken in 1.91
 1.99  09-Dec-2018  jdolecek for direct map case, avoid PGO_NOBLOCKALLOC when writing, it makes
genfs_getpages() return unallocated pages using the zero page and
PG_RDONLY; the old code relied on fault logic to get it allocated, which
the direct case can't rely on

instead just allocate the blocks right away; pass PGO_JOURNALLOCKED
so that code wouldn't try to take wapbl lock, this code path is called
with it already held

this should fix KASSERT() due to PG_RDONLY on write with wapbl

towards resolution of PR kern/53124
 1.98  20-Nov-2018  jdolecek need to use PGO_NOBLOCKALLOC also in ubc_alloc_direct() case, same
as non-direct code - otherwise the code tries to acquire the wapbl
lock again in genfs_getpages(), and panic due to locking against itself

towards PR kern/53124
 1.97  02-Jun-2018  chs branches: 1.97.2;
add missing boilerplate for UVMHIST.
 1.96  26-May-2018  jdolecek uvm_pageactivate() needs to be called _after_ code is done with the page, no reason
to bother pdaemon with PG_BUSY pages; also clear the PG_FAKE and PG_CLEAN after
we are done with the write

this does not make any difference on my machine, but maybe it might fix
the machine check panic on Martin's alpha

while here remove UBC_PARTIALOK handling from ubc_zeropage_direct(), just to be sure
it works exactly the same as the non-direct one
 1.95  19-May-2018  jdolecek change code to take advantage of direct map when available, avoiding the need
to map pages into kernel

this improves performance of UBC-based (read(2)/write(2)) I/O especially
for cached block I/O - sequential read on my NVMe goes from 1.7 GB/s to 1.9 GB/s
for non-cached, and from 2.2 GB/s to 5.6 GB/s for cached read

the new code is conditional now and off for now, so that it can be tested further;
can be turned on by adjusting ubc_direct variable to true

part of fix for PR kern/53124
 1.94  20-Apr-2018  jdolecek make ubc_alloc() and ubc_release() static, they should not be used
outside of ubc_uiomove()/ubc_zeropage(); for now mark as noinline
to keep them available as breakpoints
 1.93  26-Mar-2018  jdolecek mark ubc_winshift and ubc_winsize as __read_mostly, they are used often
so might benefit from cache placement
 1.92  09-Feb-2018  maxv branches: 1.92.2;
Use UVM_PROT_RW instead of UVM_PROT_ALL. This doesn't change anything,
since the protection code is not applied: the pages are manually kentered
as RW.

But fix it anyway, so that "pmap 0" does not say the map is executable.
 1.91  28-Oct-2017  pgoyette Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3) format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
but it is possible that I've missed some of them. I would be glad to
update any stragglers that anyone identifies.
 1.90  01-Jun-2017  chs branches: 1.90.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.89  21-Mar-2017  ozaki-r Fix typo
 1.88  20-Mar-2017  kre Ugh. This stuff is disgusting. We really need an arch dependent
PRIxOFF (and PRIdOFF) to print off_t's in a way that matches the
arch's definition of off_t.

In the meantime fall back on %jx and an (intmax_t) cast. Ugly.
(And the way it is written is even uglier...)
 1.87  20-Mar-2017  kre Third time lucky...

Why is there no PRI[xd]OFF ? How are off_t's intended to be printed?

If a PRIxOFF gets added in some appropriate place, the XXX lines in this
commit can go away.

(I understand not having PRI[xd]VOFF).
 1.86  20-Mar-2017  kre One more (should have noticed last time) and this time fix the
format the way it should have been fixed, not just what was easiest...
 1.85  20-Mar-2017  kre Perhaps fix printf format for KASSERTMSG (unbreak i386 build maybe).
This can be revisited by anyone who wants to do things better...
 1.84  19-Mar-2017  riastradh #if DIAGNOSTIC panic ---> KASSERT
 1.83  27-May-2015  rmind branches: 1.83.2; 1.83.4;
ubc_alloc: perform pmap_update() in the error path as we might have
removed the mapping.
 1.82  05-Sep-2014  matt branches: 1.82.2;
Don't nest structure definitions.
 1.81  07-Jul-2014  riastradh Initialize ubchist earlier.
 1.80  25-Oct-2013  martin branches: 1.80.2;
Mark a diagnostic-only variable
 1.79  27-Sep-2011  jym branches: 1.79.2; 1.79.12; 1.79.16;
Modify *ASSERTMSG() so they are now used as variadic macros. The main goal
is to provide routines that do as KASSERT(9) says: append a message
to the panic format string when the assertion triggers, with optional
arguments.

Fix call sites to reflect the new definition.

Discussed on tech-kern@. See
http://mail-index.netbsd.org/tech-kern/2011/09/07/msg011427.html
 1.78  29-Jun-2011  hannken Remove dead uvm_vnp_zerorange() after bump to 5.99.54.
 1.77  19-Jun-2011  rmind - Fix a silly bug: remove umap from uobj in ubc_release() UBC_UNMAP case.
- Use UBC_WANT_UNMAP() consistently.

ARM (PMAP_CACHE_VIVT case) works again.
 1.76  18-Jun-2011  rmind - Move pre-check from uvm_obj_destroy() to ubc_purge(), keep it abstracted.
- Add comments noting the race between ubc_alloc() and ubc_purge().
 1.75  17-Jun-2011  hannken When ubc_alloc() reuses a cached mapping window remove the object from
the lists AFTER clearing its mapping.

Removes a race where uvm_obj_destroy() sees an empty uo_ubc list and
destroys the object before ubc_alloc() gets the objects lock to clear
the mapping.
 1.74  16-Jun-2011  hannken Rename uvm_vnp_zerorange(struct vnode *, off_t, size_t) to
ubc_zerorange(struct uvm_object *, off_t, size_t, int) changing
the first argument to an uvm_object and adding a flags argument.

Modify tmpfs_reg_resize() to zero the backing store (aobj) instead
of the vnode. Ubc_purge() no longer panics when unmounting tmpfs.

Keep uvm_vnp_zerorange() until the next kernel version bump.
 1.73  12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.72  19-May-2011  rmind branches: 1.72.2;
ubc_release: use voff_t for offsets, rather than int. Constify.
Reviewed by matt@.
 1.71  30-Nov-2010  hannken branches: 1.71.2;
Always take the object lock before changing vmpage flags. Fixes a deadlock
where a thread is waiting on "genput" but the page in question is neither
BUSY nor WANTED.

No objections from tech-kern@.
 1.70  22-Jun-2010  rmind Keep the lock around pmap_update() where required. While fixing this
in ubc_fault(), rework logic to "remember" the last object of page and
reduce locking overhead, since in common case pages belong to one and
the same UVM object (but not always, therefore add a comment).

Unlocks before pmap_update(), on removal of mappings, might cause TLB
coherency issues, since on architectures like x86 and mips64 invalidation
IPIs are deferred to pmap_update(). Hence, VA space might be globally
visible before IPIs are sent or while they are still in-flight.

OK ad@.
 1.69  29-May-2010  rmind ubc_fault: split-off code part handling a single page into ubc_fault_page().
 1.68  07-Nov-2009  cegger branches: 1.68.2; 1.68.4;
Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
 1.67  04-Aug-2009  pooka uvm_vnp_zerorange() logically and by implementation more a part of
ubc than uvm_vnode, so move it over.
 1.66  27-Nov-2008  pooka g/c #if 0'd ubc_flush()
 1.65  05-May-2008  ad branches: 1.65.6; 1.65.8; 1.65.10; 1.65.14;
- Convert hashinit() to use kmem_alloc(). The hash tables can be large
and it's better to not have them in kmem_map.
- Convert a couple of minor items along the way to kmem_alloc().
- Fix some memory leaks.
 1.64  02-Jan-2008  ad branches: 1.64.6; 1.64.8; 1.64.10;
Merge vmlocking2 to head.
 1.63  01-Dec-2007  yamt branches: 1.63.2; 1.63.6;
constify pagerops.
 1.62  27-Jul-2007  yamt branches: 1.62.4; 1.62.6; 1.62.12; 1.62.14;
ubc_uiomove: add an "advice" argument rather than using UVM_ADV_RANDOM blindly.
 1.61  27-Jul-2007  yamt remove a debug printf.
 1.60  21-Jul-2007  ad Merge unobtrusive locking changes from the vmlocking branch.
 1.59  22-Jun-2007  yamt branches: 1.59.2;
ubc_alloc: break loans on UBC_FAULTBUSY.

it's necessary after recent file overwrite changes.
(http://mail-index.NetBSD.org/source-changes/2007/06/05/0014.html)
it should fix the problem reported by Sarton O'Brien on
current-users@/port-xen@.
(http://mail-index.NetBSD.org/current-users/2007/06/22/0001.html)
 1.58  05-Jun-2007  yamt improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
 1.57  07-May-2007  yamt add an evcnt and some assertions.
 1.56  22-Feb-2007  thorpej branches: 1.56.4; 1.56.6;
TRUE -> true, FALSE -> false
 1.55  21-Feb-2007  thorpej Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
 1.54  01-Nov-2006  yamt branches: 1.54.4;
remove some __unused from function parameters.
 1.53  19-Oct-2006  yamt add an assertion.
 1.52  12-Oct-2006  yamt move some knowledge about vnode into uvm_vnode.c.
 1.51  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.50  30-Sep-2006  yamt add ubc window hit/miss evcnts.
 1.49  30-Sep-2006  yamt ubc_fault: check UVM_OBJ_NEEDS_WRITEFAULT.
fix an assertion failure in genfs_putpages when using msdosfs.
(http://mail-index.NetBSD.org/tech-kern/2006/09/27/0002.html)
reported and tested by Darrin B.Jewell.
 1.48  03-Sep-2006  christos branches: 1.48.2; 1.48.4;
use c99 initializer.
 1.47  18-Aug-2006  yamt ubc_fault: fix a deadlock in the case of uvm_loanbreak() failure.
 1.46  03-May-2006  yamt ubc_fault: use PMAP_CANFAIL. pointed by Jed Davis on tech-kern@.
 1.45  13-Apr-2006  yamt ubc_fault: don't forget to clear PG_WANTED.
reported by Michael Lorenz on tech-kern@.
 1.44  22-Feb-2006  drochner branches: 1.44.2; 1.44.4; 1.44.6;
kill the "fault_type" argument to pager's pgo_fault() methods
it is never used
(and using it would comprise an abstraction violation imho)
 1.43  31-Jan-2006  yamt branches: 1.43.2; 1.43.4;
handle "strange" filesystems like layered filesystems and tmpfs,
where pgo_get returns pages which don't belong to the uobj.
also fix an XXX in uvm_loananon and lock-unlock mismatch in uvm_loanuobj.

PR/28372, PR/32665 (Alan Barrett).
 1.42  29-Nov-2005  yamt branches: 1.42.2;
merge yamt-readahead branch.
 1.41  23-Jul-2005  yamt branches: 1.41.6;
update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.
 1.40  17-Jul-2005  yamt - introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.

- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.
 1.39  27-Jun-2005  thorpej branches: 1.39.2;
Use ANSI function decls.
 1.38  06-Jun-2005  yamt introduce a macro to initialize uvm_object and use it.
 1.37  26-Feb-2005  perry branches: 1.37.2;
nuke trailing whitespace
 1.36  17-Jan-2005  atatat branches: 1.36.2;
Convert the PMAP_PREFER() macro from two arguments (offset and hint)
to four (adding size and direction).

In order for topdown uvm to be an option on ports using PMAP_PREFER,
they will need to "prefer" lower addresses if topdown is being used.
Additionally, at least one port also needs to know the size.
 1.35  16-Jan-2005  yamt branches: 1.35.2;
remove no longer needed #include.
 1.34  15-Jan-2005  chs deal with alpha's architectural failing of not being able to operate on
memory quantities smaller than 32 bits.
 1.33  09-Jan-2005  chs adjust the UBC mapping code to support non-vnode uvm_objects.
this means we can no longer look at the vnode size to determine how many
pages to request in a fault, which is good since for NFS the size can change
out from under us on the server anyway. there's also a new flag UBC_UNMAP
for ubc_release(), so that the file system code can make the decision about
whether to cache mappings for files being used as executables.
 1.32  05-May-2004  yamt ubc_release: grab uobj's vmobjlock when calling uvm_page_unbusy().
 1.31  24-Mar-2004  junyoung branches: 1.31.2;
Nuke __P().
 1.30  05-Mar-2004  dbj add debugging assertion ensuring UBC_FAULTBUSY is only used with UBC_WRITE
 1.29  07-Jan-2004  yamt #if 0 out unused ubc_flush().
 1.28  03-May-2003  yamt branches: 1.28.2;
fix ubc pager to take care of loan_count.
 1.27  10-Mar-2003  thorpej For PMAP_CACHE_VIVT platforms, make UBC_RELEASE_UNMAP evaluate to TRUE,
and add a comment explaining why.

Reviewed by Chuq Silvers.
 1.26  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.25  27-Feb-2002  chs branches: 1.25.10;
honor the PG_RDONLY flag (so that NFS can clear the PG_NEEDCOMMIT flag
when page with it set is modified again). fixes PR 15733.
 1.24  15-Feb-2002  simonb Add a space after a comma in a few places (KNF).
 1.23  19-Jan-2002  chs add a new flag PMAP_CACHE_VIVT for the pmap to inform the MI code that
that the cache is virtually-indexed and virtually-tagged (such as on the ARM),
and use this flag in the UBC code to be more friendly to those caches.
 1.22  19-Nov-2001  enami Zero clear an array of vm_page * before passing it to VOP_GETPAGES().
 1.21  10-Nov-2001  lukem add RCSIDs, and in some cases, slightly cleanup #include order
 1.20  16-Oct-2001  chs branches: 1.20.2;
it is with great chagrin that I must fix yet another 64-bit math bug.
 1.19  28-Sep-2001  chs don't depend on other headers to include sys/proc.h for us.
 1.18  15-Sep-2001  chs a whole bunch of changes to improve performance and robustness under load:

- remove special treatment of pager_map mappings in pmaps. this is
required now, since I've removed the globals that expose the address range.
pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
no longer any need to special-case it.
- eliminate struct uvm_vnode by moving its fields into struct vnode.
- rewrite the pageout path. the pager is now responsible for handling the
high-level requests instead of only getting control after a bunch of work
has already been done on its behalf. this will allow us to UBCify LFS,
which needs tighter control over its pages than other filesystems do.
writing a page to disk no longer requires making it read-only, which
allows us to write wired pages without causing all kinds of havoc.
- use a new PG_PAGEOUT flag to indicate that a page should be freed
on behalf of the pagedaemon when it's unlocked. this flag is very similar
to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
pageout fails due to eg. an indirect-block buffer being locked.
this allows us to remove the "version" field from struct vm_page,
and together with shrinking "loan_count" from 32 bits to 16,
struct vm_page is now 4 bytes smaller.
- no longer use PG_RELEASED for swap-backed pages. if the page is busy
because it's being paged out, we can't release the swap slot to be
reallocated until that write is complete, but unlike with vnodes we
don't keep a count of in-progress writes so there's no good way to
know when the write is done. instead, when we need to free a busy
swap-backed page, just sleep until we can get it busy ourselves.
- implement a fast-path for extending writes which allows us to avoid
zeroing new pages. this substantially reduces cpu usage.
- encapsulate the data used by the genfs code in a struct genfs_node,
which must be the first element of the filesystem-specific vnode data
for filesystems which use genfs_{get,put}pages().
- eliminate many of the UVM pagerops, since they aren't needed anymore
now that the pager "put" operation is a higher-level operation.
- enhance the genfs code to allow NFS to use the genfs_{get,put}pages
instead of a modified copy.
- clean up struct vnode by removing all the fields that used to be used by
the vfs_cluster.c code (which we don't use anymore with UBC).
- remove kmem_object and mb_object since they were useless.
instead of allocating pages to these objects, we now just allocate
pages with no object. such pages are mapped in the kernel until they
are freed, so we can use the mapping to find the page to free it.
this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
 1.17  10-Sep-2001  chris Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.16  18-Jul-2001  thorpej branches: 1.16.2;
bzero -> memset
 1.15  13-Jun-2001  simonb branches: 1.15.2;
Add a sanity check for ubc_winshift.
 1.14  26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.13  25-May-2001  chs remove trailing whitespace.
 1.12  24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.11  19-Mar-2001  chs change uvm_winsize to uvm_winshift so that we can avoid division
by a non-constant value.
 1.10  17-Mar-2001  chs return the real error from VOP_GETPAGES().
 1.9  15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.8  10-Mar-2001  chs eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:

VM_PAGER_OK 0
VM_PAGER_BAD <unused>
VM_PAGER_FAIL <unused>
VM_PAGER_PEND 0 (see below)
VM_PAGER_ERROR EIO
VM_PAGER_AGAIN EAGAIN
VM_PAGER_UNLOCK EBUSY
VM_PAGER_REFAULT ERESTART

for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
 1.7  02-Feb-2001  enami branches: 1.7.2;
Explicitly panic if failed to allocate some memory during initialization.
 1.6  27-Dec-2000  chs fix some types so that files larger than 4GB work.
 1.5  27-Dec-2000  chs VOP_GETPAGES() returns an E* error code, not a VM_PAGER_* error code.
 1.4  21-Dec-2000  enami s/UBC_WINSIZE/ubc_winsize/g except the variable initialization.
 1.3  10-Dec-2000  chs we don't need VM_PROT_EXECUTE for UBC mappings.
 1.2  27-Nov-2000  chs Initial integration of the Unified Buffer Cache project.
 1.1  09-Nov-1998  chs branches: 1.1.2; 1.1.4; 1.1.6;
file uvm_bio.c was initially added on branch chs-ubc.
 1.1.6.6  27-Mar-2001  bouyer Sync with HEAD.
 1.1.6.5  12-Mar-2001  bouyer Sync with HEAD.
 1.1.6.4  11-Feb-2001  bouyer Sync with HEAD.
 1.1.6.3  05-Jan-2001  bouyer Sync with HEAD
 1.1.6.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.6.1  08-Dec-2000  bouyer Sync with HEAD.
 1.1.4.6  11-Aug-1999  chs add a few casts to play better with 64bit vnode offsets.
 1.1.4.5  09-Aug-1999  chs create a new type "voff_t" for uvm_object offsets
and define it to be "off_t". also, remove pgo_asyncget().
 1.1.4.4  31-Jul-1999  chs in ubc_fault(), call VOP_GETPAGES() directly instead of going thru pgo_get().
also, we no longer to play games with the vm size of the file for nfs
(we actually need to do this for all filesystems, but not here).
 1.1.4.3  04-Jul-1999  chs support VACs better by having multiple inactive queues.
when creating a mapping, use the queue with the right alignment skew
for the requested offset. this also supports any size mapping windows.
when reading from a VTEXT vnode, flush the mapping in ubc_release().
 1.1.4.2  21-Jun-1999  thorpej Make this compile in the face of some UVM interface changes, and kill
void * arithmetic.
 1.1.4.1  21-Jun-1999  thorpej Chuq apparently forgot to place this on the ubc2 branch.
 1.1.2.5  30-May-1999  chs in ubc_flush(), also flush any pmap mappings in ranges we flush.
 1.1.2.4  30-Apr-1999  chs change ubc_alloc()'s length arg to be a pointer instead of the value.
the pointed-to value is the total desired length on input,
and is updated to the length that will fit in the returned window.
this allows callers of ubc_alloc() to be ignorant of the window size.
 1.1.2.3  09-Apr-1999  chs minor cleanup.
 1.1.2.2  25-Feb-1999  chs rename nubc to ubc_nwins. other cleanup.
 1.1.2.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.7.2.10  18-Oct-2002  nathanw Catch up to -current.
 1.7.2.9  28-Feb-2002  nathanw Catch up to -current.
 1.7.2.8  08-Jan-2002  nathanw Catch up to -current.
 1.7.2.7  14-Nov-2001  nathanw Catch up to -current.
 1.7.2.6  22-Oct-2001  nathanw Catch up to -current.
 1.7.2.5  08-Oct-2001  nathanw Catch up to -current.
 1.7.2.4  21-Sep-2001  nathanw Catch up to -current.
 1.7.2.3  24-Aug-2001  nathanw Catch up with -current.
 1.7.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.7.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.15.2.6  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.15.2.5  16-Mar-2002  jdolecek Catch up with -current.
 1.15.2.4  11-Feb-2002  jdolecek Sync w/ -current.
 1.15.2.3  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.2  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.15.2.1  03-Aug-2001  lukem update to -current
 1.16.2.1  01-Oct-2001  fvdl Catch up with -current.
 1.20.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.25.10.1  02-Jun-2003  tron Pull up revision 1.27 (requested by thorpej in ticket #1207):
For PMAP_CACHE_VIVT platforms, make UBC_RELEASE_UNMAP evaluate to TRUE,
and add a comment explaining why.
Reviewed by Chuq Silvers.
 1.28.2.7  11-Dec-2005  christos Sync with head.
 1.28.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.28.2.4  17-Jan-2005  skrll Sync with HEAD.
 1.28.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1  03-Aug-2004  skrll Sync with HEAD
 1.31.2.1  10-May-2004  tron Pull up revision 1.32 (requested by yamt in ticket #271):
ubc_release: grab uobj's vmobjlock when calling uvm_page_unbusy().
 1.35.2.2  29-Apr-2005  kent sync with -current
 1.35.2.1  16-Jan-2005  kent file uvm_bio.c was added on branch kent-audio2 on 2005-04-29 11:29:40 +0000
 1.36.2.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.37.2.2  28-Jul-2006  tron Apply patch (requested by jld in ticket #1323):
Avoid a panic in page fault handling that can occur under low-memory
conditions.
 1.37.2.1  24-Aug-2005  riz branches: 1.37.2.1.2;
Pull up following revision(s) (requested by yamt in ticket #688):
sys/miscfs/genfs/genfs_vnops.c: revision 1.98 via patch
sys/ufs/ffs/ffs_vfsops.c: revision 1.165
sys/ufs/lfs/lfs_extern.h: revision 1.69
sys/fs/filecorefs/filecore_vfsops.c: revision 1.20
sys/nfs/nfs_node.c: revision 1.80
sys/fs/smbfs/smbfs_node.c: revision 1.24
sys/fs/cd9660/cd9660_vfsops.c: revision 1.24
sys/fs/msdosfs/msdosfs_denode.c: revision 1.8
sys/miscfs/genfs/genfs_node.h: revision 1.6
sys/ufs/lfs/lfs_vfsops.c: revision 1.183
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.86
sys/fs/adosfs/advfsops.c: revision 1.23
sys/fs/ntfs/ntfs_vfsops.c: revision 1.31
- constify genfs_ops.
- use member designators.

sys/miscfs/genfs/genfs_vnops.c: revision 1.99 via patch
genfs_getpages: don't forget to put the vnode onto the syncer's work que
ue
even in the case of PGO_LOCKED.

sys/uvm/uvm_bio.c: revision 1.40
sys/uvm/uvm_pager.h: revision 1.29
sys/miscfs/genfs/genfs_vnops.c: revision 1.100 via patch
sys/ufs/ufs/ufs_inode.c: revision 1.50
- introduce PGO_NOBLOCKALLOC and use it for ubc mapping
to prevent unnecessary block allocations in the case that
page size > block size.
- ufs_balloc_range: use VM_PROT_WRITE+PGO_NOBLOCKALLOC rather than
VM_PROT_READ.

sys/uvm/uvm_fault.c: revision 1.96
sys/miscfs/genfs/genfs_vnops.c: revision 1.101 via patch
sys/uvm/uvm_object.h: revision 1.19
sys/miscfs/genfs/genfs_node.h: revision 1.7
ensure that vnodes with dirty pages are always on syncer's queue.
- genfs_putpages: wait for i/o completion of PG_RELEASED/PG_PAGEOUT pages by
setting "wasclean" false when encountering them.
suggested by Stephan Uphoff in PR/24596 (1).
- genfs_putpages: write protect pages when cleaning out, if
we're going to take the vnode off the syncer's queue.
uvm_fault: don't write-map pages unless its vnode is already on
the syncer's queue.
fix PR/24596 (3) but in the different way from the suggested fix.
(to keep our current behaviour, ie. not to require explicit msync.
discussed on tech-kern@.)
- genfs_putpages: don't mistakenly take a vnode off the queue
by introducing a generation number in genfs_node.
genfs_getpages: increment the generation number.
suggested by Stephan Uphoff in PR/24596 (2).
- add some assertions.

sys/miscfs/genfs/genfs_vnops.c: revision 1.102 via patch
genfs_putpages: don't bother to clean the vnode unless VONWORKLST.

sys/ufs/ffs/ffs_vnops.c: revision 1.71
ffs_full_fsync: because VBLK/VCHR can be mmap'ed,
do VOP_PUTPAGES for them as well.

sys/uvm/uvm_fault.c: revision 1.97
uvm_fault: check a correct object in the case of layered filesystems.
fix PR/30811 from Jukka Salmi.

sys/uvm/uvm_object.h: revision 1.20
sys/ufs/ffs/ffs_vfsops.c: revision 1.167
sys/uvm/uvm_bio.c: revision 1.41
sys/ufs/ufs/ufs_vnops.c: revision 1.129
sys/uvm/uvm_mmap.c: revision 1.92
sys/uvm/uvm_fault.c: revision 1.98
sys/kern/vfs_subr.c: revision 1.252
sys/fs/msdosfs/denode.h: revision 1.5
sys/miscfs/genfs/genfs_vnops.c: revision 1.103 via patch
sys/fs/msdosfs/msdosfs_denode.c: revision 1.9
sys/sys/vnode.h: revision 1.141
sys/ufs/ufs/ufs_inode.c: revision 1.51
sys/ufs/ufs/ufs_extern.h: revision 1.45 via patch
sys/miscfs/genfs/genfs_node.h: revision 1.8
sys/ufs/lfs/lfs_vfsops.c: revision 1.184
sys/uvm/uvm_pager.h: revision 1.30
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.87
update file timestamps for nfsd loaned-read and mmap.
PR/25279. discussed on tech-kern@.

sys/miscfs/genfs/genfs_vnops.c: revision 1.104 via patch
don't write-protect wired pages. pointed by Chuck Silvers.
for now, leave a vnode on the syncer's queue, as suggested by him.

sys/ufs/ffs/ffs_vnops.c: revision 1.72
revert VCHR part of ffs_vnops.c 1.71.
as VCHR uses the device pager, no point to call VOP_PUTPAGES here.
pointed by Chuck Silvers.
 1.37.2.1.2.1  28-Jul-2006  tron Apply patch (requested by jld in ticket #1323):
Avoid a panic in page fault handling that can occur under low-memory
conditions.
 1.39.2.6  21-Jan-2008  yamt sync with head
 1.39.2.5  07-Dec-2007  yamt sync with head
 1.39.2.4  03-Sep-2007  yamt sync with head.
 1.39.2.3  26-Feb-2007  yamt sync with head.
 1.39.2.2  30-Dec-2006  yamt sync with head.
 1.39.2.1  21-Jun-2006  yamt sync with head.
 1.41.6.1  19-Nov-2005  yamt - as read-ahead context is per-vnode now,
there are less reasons to make VOP_READ call uvm_ra_request explicitly.
move it to pager (uvn_get) so that it can handle accesses via mmap as well.
- pass advice to pager via ubc.
- tweak DPRINTF.

XXX can be disturbed by PGO_LOCKED.

XXX it's controversial where it should be done.
(uvm_fault, uvn_get or genfs_getpages.)
 1.42.2.2  01-Mar-2006  yamt sync with head.
 1.42.2.1  01-Feb-2006  yamt sync with head.
 1.43.4.2  01-Jun-2006  kardel Sync with head.
 1.43.4.1  22-Apr-2006  simonb Sync with head.
 1.43.2.1  09-Sep-2006  rpaulo sync with head
 1.44.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.44.4.2  11-May-2006  elad sync with head
 1.44.4.1  19-Apr-2006  elad oops - *really* sync to head this time.
 1.44.2.3  14-Sep-2006  yamt sync with head.
 1.44.2.2  03-Sep-2006  yamt sync with head.
 1.44.2.1  24-May-2006  yamt sync with head.
 1.48.4.2  10-Dec-2006  yamt sync with head.
 1.48.4.1  22-Oct-2006  yamt sync with head
 1.48.2.1  18-Nov-2006  ad Sync with head.
 1.54.4.2  17-May-2007  yamt sync with head.
 1.54.4.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.56.6.1  11-Jul-2007  mjf Sync with head.
 1.56.4.10  20-Aug-2007  ad Sync with HEAD.
 1.56.4.9  27-Jul-2007  yamt revert the previous as it was committed mistakenly. (wrong branch)
 1.56.4.8  27-Jul-2007  yamt remove a debug printf.
 1.56.4.7  18-Jul-2007  ad Fix a couple of deadlocks I introduced.
 1.56.4.6  15-Jul-2007  ad Sync with head.
 1.56.4.5  15-Jul-2007  ad Sync with head.
 1.56.4.4  09-Jun-2007  ad Sync with head.
 1.56.4.3  08-Jun-2007  ad Sync with head.
 1.56.4.2  05-Apr-2007  ad - Put a per-LWP lock around swapin / swapout.
- Replace use of lockmgr().
- Minor locking fixes and assertions.
- uvm_map.h no longer pulls in proc.h, etc.
- Use kpause where appropriate.
 1.56.4.1  13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.59.2.1  15-Aug-2007  skrll Sync with HEAD.
 1.62.14.2  27-Jul-2007  yamt ubc_uiomove: add an "advice" argument rather than using UVM_ADV_RANDOM blindly.
 1.62.14.1  27-Jul-2007  yamt file uvm_bio.c was added on branch matt-mips64 on 2007-07-27 09:50:38 +0000
 1.62.12.2  18-Feb-2008  mjf Sync with HEAD.
 1.62.12.1  08-Dec-2007  mjf Sync with HEAD.
 1.62.6.1  09-Jan-2008  matt sync with HEAD
 1.62.4.1  03-Dec-2007  joerg Sync with HEAD.
 1.63.6.1  02-Jan-2008  bouyer Sync with HEAD
 1.63.2.1  04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.64.10.5  11-Aug-2010  yamt sync with head.
 1.64.10.4  11-Mar-2010  yamt sync with head
 1.64.10.3  19-Aug-2009  yamt sync with head.
 1.64.10.2  04-May-2009  yamt sync with head.
 1.64.10.1  16-May-2008  yamt sync with head.
 1.64.8.1  18-May-2008  yamt sync with head.
 1.64.6.2  17-Jan-2009  mjf Sync with HEAD.
 1.64.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.65.14.1  29-Feb-2012  matt Improve UVM_PAGE_TRKOWN.
Add more asserts to uvm_page.
 1.65.10.1  21-Nov-2010  riz Pull up following revision(s) (requested by rmind in ticket #1421):
sys/uvm/uvm_bio.c: revision 1.70
sys/uvm/uvm_map.c: revision 1.292
sys/uvm/uvm_pager.c: revision 1.98
sys/uvm/uvm_fault.c: revision 1.175
sys/uvm/uvm_bio.c: revision 1.69
ubc_fault: split-off code part handling a single page into ubc_fault_page().
Keep the lock around pmap_update() where required. While fixing this
in ubc_fault(), rework logic to &quot;remember&quot; the last object of page and
reduce locking overhead, since in common case pages belong to one and
the same UVM object (but not always, therefore add a comment).
Unlocks before pmap_update(), on removal of mappings, might cause TLB
coherency issues, since on architectures like x86 and mips64 invalidation
IPIs are deferred to pmap_update(). Hence, VA space might be globally
visible before IPIs are sent or while they are still in-flight.
OK ad@.
 1.65.8.1  19-Jan-2009  skrll Sync with HEAD.
 1.65.6.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.68.4.8  31-May-2011  rmind sync with head
 1.68.4.7  19-May-2011  rmind Implement sharing of vnode_t::v_interlock amongst vnodes:
- Lock is shared amongst UVM objects using uvm_obj_setlock() or getnewvnode().
- Adjust vnode cache to handle unsharing, add VI_LOCKSHARE flag for that.
- Use sharing in tmpfs and layerfs for underlying object.
- Simplify locking in ubc_fault().
- Sprinkle some asserts.

Discussed with ad@.
 1.68.4.6  03-Jul-2010  rmind sync with head
 1.68.4.5  30-May-2010  rmind sync with head
 1.68.4.4  26-Apr-2010  rmind Add ubc_purge() and purge/deassociate any related UBC entries during
object (usually, vnode) destruction. Since locking (and thus object)
is required to enter/remove mappings - object is not allowed anymore
to disappear with any UBC entries left.

From original patch by ad@ with some modifications.
 1.68.4.3  25-Apr-2010  rmind ubc_alloc: when replacing a cache entry, lock the old object from which we
are deassociating and removing the old mapping.
 1.68.4.2  17-Mar-2010  rmind Reorganise UVM locking to protect P->V state and serialise pmap(9)
operations on the same page(s) by always locking their owner. Hence
lock order: "vmpage"-lock -> pmap-lock.

Patch, proposed on tech-kern@, from Andrew Doran.
 1.68.4.1  16-Mar-2010  rmind Change struct uvm_object::vmobjlock to be dynamically allocated with
mutex_obj_alloc(). It allows us to share the locks among UVM objects.
 1.68.2.14  21-Nov-2010  uebayasi Rename PGO_ZERO as PGO_HOLE, and s/uvm_page_zeropage/uvm_page_holepage/.
 1.68.2.13  21-Nov-2010  uebayasi Resurrect PGO_ZERO support.

When vnode pager encounters hole pages in XIP'ed vnodes, it fills
page slots with PGO_ZERO and returns them back to the caller (fault
handler). Fault handlers are responsible to check page slots and
redirect PGO_ZERO to the single "zero page" allocated by calling
uvm_page_zeropage_alloc(9).

The zero page is wired, read-only (PG_RDONLY) page. It's shared
by multiple vnodes, it has no single owner.

XIP'ed vnodes are supposed to be "stable" during I/O (unlocked).
Because XIP'ed mounts are always read-only. There's no chance to
change mappings of XIP'ed vnodes and their XIP'ed pages. Thus the
cached uobj is reused after pgo_get() for PGO_ZERO.

(Do we need a new concept of "read-only UVM object"?)
 1.68.2.12  04-Nov-2010  uebayasi Split physical device segment pages from "managed" to "managed
device". Cache that information as a flag PG_DEVICE so that callers
don't need to walk physsegs everytime.

Remove PQ_FIXED, which means that page daemon doesn't need to know
device segment pages at all. But still fault handlers need to know
them.

I think this is what I can do best now.
 1.68.2.11  17-Aug-2010  uebayasi Sync with HEAD.
 1.68.2.10  22-Jul-2010  uebayasi s/PG_XIP/PQ_FIXED/, meaning that the fault handler sees XIP pages as
"fixed", and doesn't pass them to paging activity.

("XIP" is a vnode specific knowledge. It was wrong that the fault
handler had to know such a special thing.)
 1.68.2.9  15-Jul-2010  uebayasi Rename PG_DIRECT to PG_XIP. PG_XIP is marked to XIP vnode pages.
 1.68.2.8  13-Jul-2010  uebayasi Reduce more diffs from the original.
 1.68.2.7  12-Jul-2010  uebayasi Reduce more diff by backing out XIP page specific code. Allow XIP pages
to be loaned.
 1.68.2.6  09-Jul-2010  uebayasi Mark XIP pages as PG_CLEAN and/or PG_BUSY when appropriate. Protect
vnode lock when vm_page::flags is manipulated.
 1.68.2.5  08-Jul-2010  uebayasi Mark XIP pages as PG_RDONLY.
 1.68.2.4  07-Jul-2010  uebayasi Clean up; merge options DIRECT_PAGE into options XIP.
 1.68.2.3  31-May-2010  uebayasi Re-define the definition of "device page"; device pages are pages of
device memory. Pages which don't have vm_page (== can't be used for
generic use), but whose PV are tracked, are called "direct pages" from
now.
 1.68.2.2  23-Feb-2010  uebayasi ubc_alloc: Don't forget taking the parent's vmobjlock in device page cases.
 1.68.2.1  12-Feb-2010  uebayasi Teach device page handling.
 1.71.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.72.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.79.16.1  18-May-2014  rmind sync with head
 1.79.12.2  03-Dec-2017  jdolecek update from HEAD
 1.79.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.2.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.79.2.2  17-Feb-2012  yamt byebye PG_HOLE as it turned out to be unnecessary.
 1.79.2.1  02-Nov-2011  yamt page cache related changes

- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
 1.80.2.1  10-Aug-2014  tls Rebase.
 1.82.2.2  28-Aug-2017  skrll Sync with HEAD
 1.82.2.1  06-Jun-2015  skrll Sync with HEAD
 1.83.4.1  21-Apr-2017  bouyer Sync with HEAD
 1.83.2.2  26-Apr-2017  pgoyette Sync with HEAD
 1.83.2.1  20-Mar-2017  pgoyette Sync with HEAD
 1.90.2.1  02-Nov-2017  snj Pull up following revision(s) (requested by pgoyette in ticket #335):
share/man/man9/kernhist.9: 1.5-1.8
sys/arch/acorn26/acorn26/pmap.c: 1.39
sys/arch/arm/arm32/fault.c: 1.105 via patch
sys/arch/arm/arm32/pmap.c: 1.350, 1.359
sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
sys/arch/arm/omap/if_cpsw.c: 1.20
sys/arch/arm/omap/tiotg.c: 1.7
sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
sys/dev/ic/sl811hs.c: 1.98
sys/dev/usb/ehci.c: 1.256
sys/dev/usb/if_axe.c: 1.83
sys/dev/usb/motg.c: 1.18
sys/dev/usb/ohci.c: 1.274
sys/dev/usb/ucom.c: 1.119
sys/dev/usb/uhci.c: 1.277
sys/dev/usb/uhub.c: 1.137
sys/dev/usb/umass.c: 1.160-1.162
sys/dev/usb/umass_quirks.c: 1.100
sys/dev/usb/umass_scsipi.c: 1.55
sys/dev/usb/usb.c: 1.168
sys/dev/usb/usb_mem.c: 1.70
sys/dev/usb/usb_subr.c: 1.221
sys/dev/usb/usbdi.c: 1.175
sys/dev/usb/usbdi_util.c: 1.67-1.70
sys/dev/usb/usbroothub.c: 1.3
sys/dev/usb/xhci.c: 1.75
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
sys/kern/kern_history.c: 1.15
sys/kern/kern_xxx.c: 1.74
sys/kern/vfs_bio.c: 1.275-1.276
sys/miscfs/genfs/genfs_io.c: 1.71
sys/sys/kernhist.h: 1.21
sys/ufs/ffs/ffs_balloc.c: 1.63
sys/ufs/lfs/lfs_vfsops.c: 1.361
sys/ufs/lfs/ulfs_inode.c: 1.21
sys/ufs/lfs/ulfs_vnops.c: 1.52
sys/ufs/ufs/ufs_inode.c: 1.102
sys/ufs/ufs/ufs_vnops.c: 1.239
sys/uvm/pmap/pmap.c: 1.37-1.39
sys/uvm/pmap/pmap_tlb.c: 1.22
sys/uvm/uvm_amap.c: 1.108
sys/uvm/uvm_anon.c: 1.64
sys/uvm/uvm_aobj.c: 1.126
sys/uvm/uvm_bio.c: 1.91
sys/uvm/uvm_device.c: 1.66
sys/uvm/uvm_fault.c: 1.201
sys/uvm/uvm_km.c: 1.144
sys/uvm/uvm_loan.c: 1.85
sys/uvm/uvm_map.c: 1.353
sys/uvm/uvm_page.c: 1.194
sys/uvm/uvm_pager.c: 1.111
sys/uvm/uvm_pdaemon.c: 1.109
sys/uvm/uvm_swap.c: 1.175
sys/uvm/uvm_vnode.c: 1.103
usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in
the kernel and in the structures used for exporting the history data
to userland via sysctl(9). This avoids problems on some architectures
where passing a 64-bit (or larger) value to printf(3) can cause it to
process the value as multiple arguments. (This can be particularly
problematic when printf()'s format string is not a literal, since in
that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to
include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings
updated. Each format specifier now includes an explicit length
modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings
updated to replace uses of "%p" with "%#jx", and the pointer
arguments are now cast to (uintptr_t) before being subsequently cast
to (uintmax_t). This is needed to avoid compiler warnings about
casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or
"%c" format strings replaced with numeric formats; several instances
of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the
history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with
the -u option does not exist (previously, this condition was silently
ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the
data exported via sysctl(9) and exits if they do not match the values
with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional
requirements imposed on the format strings, along with several other
minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example,
uint64_t) for the history arguments. But that would require another
"rototill" of all the users in the future when we add support for an
architecture that supports a larger size. Also, the printf(3)
format
specifiers for explicitly-sized values, such as "%"PRIu64, are much
more verbose (and less aesthetically appealing, IMHO) than simply
using "%ju".
[2] I've tried very hard to find "all [the] existing users of
kernhist(9)"
but it is possible that I've missed some of them. I would be glad
to
update any stragglers that anyone identifies.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes. Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one. :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.
 1.92.2.6  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.92.2.5  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.92.2.4  25-Jun-2018  pgoyette Sync with HEAD
 1.92.2.3  21-May-2018  pgoyette Sync with HEAD
 1.92.2.2  22-Apr-2018  pgoyette Sync with HEAD
 1.92.2.1  30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.97.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.97.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.97.2.1  10-Jun-2019  christos Sync with HEAD
 1.102.2.2  29-Feb-2020  ad Sync with head.
 1.102.2.1  17-Jan-2020  ad Sync with head.
 1.108.2.1  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.123.2.2  03-Apr-2021  thorpej Sync with HEAD.
 1.123.2.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.125.2.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed