Home | History | Annotate | Download | only in uvm
History log of /src/sys/uvm/uvm_stat.c
RevisionDateAuthorComments
 1.46  14-Jun-2020  ad Remove PG_ZERO. It worked brilliantly on x86 machines from the mid-90s but
having spent an age experimenting with it over the last 6 months on various
machines and with different use cases it's always either break-even or a
slight net loss for me.
 1.45  11-Jun-2020  ad Counter tweaks:

- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one(). It has no users and doesn't save a whole lot.
For the cheap option, give cpu_count_sync() a boolean parameter indicating
that a cached value is okay, and rate limit the updates for cached values
to hz.
 1.44  11-Jun-2020  ad uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.43  31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.42  21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.41  16-Dec-2019  ad - Extend the per-CPU counters matt@ did to include all of the hot counters
in UVM, excluding uvmexp.free, which needs special treatment and will be
done with a separate commit. Cuts system time for a build by 20-25% on
a 48 CPU machine w/DIAGNOSTIC.

- Avoid 64-bit integer divide on every fault (for rnd_add_uint32).
 1.40  09-May-2019  skrll Avoid KASSERT(!cpu_intr_p()) when breaking into ddb and issuing

show uvmexp
 1.39  02-Dec-2017  mrg branches: 1.39.4;
add two new members to uvmexp_sysctl{}: bootpages and poolpages.
bootpages is set to the pages allocated via uvm_pageboot_alloc().
poolpages is calculated from the list of pools nr_pages members.

this brings us closer to having a valid total of pages known by
the system, vs actual pages originally managed.

XXX: poolpages needs some handling for PR_RECURSIVE pools still.
 1.38  01-Dec-2016  mrg fix the output of ddb's "show uvmexp" and also print the
reserve_pagedaemon, reserve_kernel, and zeropages values.
 1.37  17-May-2011  mrg branches: 1.37.14; 1.37.32; 1.37.36;
move and rename the uvm history code out of uvm_stat to "kernhist".

rename "UVMHIST" option to enable the uvm histories.

TODO:
- make UVMHIST properly depend upon KERNHIST
- enable dynamic registration of histories. this is mostly just
allocating something in a bitmap, and is only for viewing multiple
histories in a merged form.


tested on amd64 and sparc64.
 1.36  02-Feb-2011  chuck udpate license clauses on my code to match the new-style BSD licenses.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.35  05-Jan-2011  enami branches: 1.35.2; 1.35.4;
Fix format string; use PRIu64 for uint64_t.
 1.34  04-Jan-2011  matt Print the number of page colors in use with db> show uvm
 1.33  20-Dec-2010  matt Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.32  21-Oct-2009  rmind branches: 1.32.4;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.31  08-Aug-2008  skrll branches: 1.31.12;
Make "show uvmhist" available to all arches (not just sparc*) in ddb.
 1.30  15-Sep-2006  yamt branches: 1.30.50; 1.30.54; 1.30.56; 1.30.58; 1.30.60;
merge yamt-pdpolicy branch.
- separate page replacement policy from the rest of kernel
- implement an alternative replacement policy
 1.29  29-Nov-2005  yamt branches: 1.29.8; 1.29.20;
read-ahead statistics.
 1.28  27-Jun-2005  thorpej branches: 1.28.2; 1.28.8;
Use ANSI function decls.
 1.27  15-May-2005  yamt remove anon related statistics which are no longer used.
 1.26  27-Apr-2005  yamt uvmexp_print: print swpgavail as well.
 1.25  23-Nov-2004  yamt branches: 1.25.4;
introduce UVMHIST_LOANHIST and sprinkle UVMHIST_LOGs.
 1.24  01-May-2004  petrov Replace uvm counters with evcnt, initialize them through __link_set (from Matt Thomas),
disable counters by default and add configuration option UVMMAP_COUNTERS.
 1.23  24-Mar-2004  junyoung branches: 1.23.2;
Nuke __P().
 1.22  09-Dec-2001  chs branches: 1.22.16;
add {anon,file,exec}max as a upper bound on the amount of memory that
will be allocated for the respective usage types when there is contention
for memory.

replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names
and sysctl names.
 1.21  10-Nov-2001  lukem add RCSIDs, and in some cases, slightly cleanup #include order
 1.20  15-Sep-2001  chs branches: 1.20.2;
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.19  25-May-2001  chs branches: 1.19.2; 1.19.4;
remove trailing whitespace.
 1.18  09-Mar-2001  chs add UBC memory-usage balancing. we track the number of pages in use for
each of the basic types (anonymous data, executable image, cached files)
and prevent the pagedaemon from reusing a given page if that would reduce
the count of that type of page below a sysctl-setable minimum threshold.
the thresholds are controlled via three new sysctl tunables:
vm.anonmin, vm.vnodemin, and vm.vtextmin. these tunables are the
percentages of pageable memory reserved for each usage, and we do not allow
the sum of the minimums to be more than 95% so that there's always some
memory that can be reused.
 1.17  04-Feb-2001  mrg branches: 1.17.2;
allow ubchist to be printed from the uvmhist merging uvm_hist()
 1.16  01-Dec-2000  chs add new uvmexp fields for uvmexp_print().
 1.15  24-Nov-2000  chs add ddb commands "show uvmexp" and "show ncache".
the former used to be "call uvm_dump", the latter is new.
 1.14  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.13  11-Jan-2000  chs add support for ``swapctl -d'' (removing swap space).
improve handling of i/o errors in swap space.

reviewed by: Chuck Cranor
 1.12  26-Mar-1999  chs branches: 1.12.4; 1.12.8;
add uvmexp.swpgonly and use it to detect out-of-swap conditions.
 1.11  25-Mar-1999  mrg remove now >1 year old pre-release message.
 1.10  20-Jun-1998  mrg branches: 1.10.4;
Add new history grovelling function uvm_hist() that takes a bitmask of
histories to merge in cronological order. currently, MAPHIST and
PDHIST are defined as 1 and 2 respectively. passing a bitmask of 0
to uvm_hist() will dump all maps.
 1.9  10-Mar-1998  chuck uvm_dump now dumps some important pointers for debugging
 1.8  13-Feb-1998  thorpej Oops, fix a typo.
 1.7  13-Feb-1998  thorpej KNF.
 1.6  13-Feb-1998  thorpej Add a global list of all UVM histories.
 1.5  12-Feb-1998  thorpej Provide a patchable knob (uvmhist_print_enabled) so that UVM history
buffer printing can be switched on and off at run-time. Only exists
if the kernel is build with UVMHIST_PRINT, and defaults to `on'.
 1.4  10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.3  07-Feb-1998  mrg restore rcsids
 1.2  06-Feb-1998  thorpej RCS ID police.
 1.1  05-Feb-1998  mrg branches: 1.1.1;
Initial revision
 1.1.1.1  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the UVM kernel code portion.


this will be KNF'd shortly. :-)
 1.10.4.2  25-Feb-1999  chs print more stuff in uvm_dump().
 1.10.4.1  09-Nov-1998  chs initial snapshot. lots left to do.
 1.12.8.4  12-Mar-2001  bouyer Sync with HEAD.
 1.12.8.3  11-Feb-2001  bouyer Sync with HEAD.
 1.12.8.2  08-Dec-2000  bouyer Sync with HEAD.
 1.12.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.12.4.1  07-Jun-1999  chs merge everything from chs-ubc branch.
 1.17.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.17.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.17.2.3  21-Sep-2001  nathanw Catch up to -current.
 1.17.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.17.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.19.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.19.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.22.16.6  11-Dec-2005  christos Sync with head.
 1.22.16.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.16.4  29-Nov-2004  skrll Sync with HEAD.
 1.22.16.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.16.2  18-Sep-2004  skrll Sync with HEAD.
 1.22.16.1  03-Aug-2004  skrll Sync with HEAD
 1.23.2.1  09-May-2004  jdc Pull up revision 1.24 (requested by petrov in ticket #269)

Replace uvm counters with evcnt, initialize them through __link_set (from Matt Thomas),
disable counters by default and add configuration option UVMMAP_COUNTERS.
 1.25.4.1  29-Apr-2005  kent sync with -current
 1.28.8.1  29-Nov-2005  yamt sync with head.
 1.28.2.2  30-Dec-2006  yamt sync with head.
 1.28.2.1  21-Jun-2006  yamt sync with head.
 1.29.20.1  18-Nov-2006  ad Sync with head.
 1.29.8.1  05-Mar-2006  yamt separate page replacement policy from the rest of kernel.
 1.30.60.1  19-Oct-2008  haad Sync with HEAD.
 1.30.58.2  27-Jun-2008  simonb Revert local changes that were not meant to be in previous "sync with
head" commit.
 1.30.58.1  27-Jun-2008  simonb Sync with head.
 1.30.56.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.54.2  11-Mar-2010  yamt sync with head
 1.30.54.1  04-May-2009  yamt sync with head.
 1.30.50.1  28-Sep-2008  mjf Sync with HEAD.
 1.31.12.4  12-Apr-2012  matt Separate object-less anon pages out of the active list if there is no swap
device. Make uvm_reclaimable and uvm.*estimatable understand colors and
kmem allocations.
 1.31.12.3  16-Feb-2012  matt Track the victims selected by the pagedaemon and what happens to then.
Keep a hint for what page group has the most free pages for a given color.
 1.31.12.2  09-Feb-2012  matt Major changes to uvm.
Support multiple collections (groups) of free pages and run the page
reclaimation algorithm on each group independently.
 1.31.12.1  22-Jan-2010  matt Print out colors in uvmexp_print
 1.32.4.2  31-May-2011  rmind sync with head
 1.32.4.1  05-Mar-2011  rmind sync with head
 1.35.4.1  08-Feb-2011  bouyer Sync with HEAD
 1.35.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.37.36.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.37.32.1  05-Dec-2016  skrll Sync with HEAD
 1.37.14.1  03-Dec-2017  jdolecek update from HEAD
 1.39.4.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.39.4.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed