Commit Graph

326 Commits

Author SHA1 Message Date
simonb
ed668386fb Drop setgid kmem, simplify nlist setup. 2021-04-02 06:28:55 +00:00
simonb
2498171cf2 Use kernel sysctl hashstat collection instead of kmem grovelling
directly.  Also GC a few old hash nlist entries that no longer exist.
2021-04-01 06:23:14 +00:00
simonb
a892c37c69 Now that ports that use legacy intrcnt interrupt accounting have event
counters to show that data, for the live kernel case just show INTR
events for "vmstat -i".
2021-04-01 05:33:50 +00:00
simonb
6e33305585 For vmstat -h/-H, calculate the hash element size correctly instead of
assuming that everything that isn't a list is a tailq.  Fixes random
reads from kmem that either fail or return incorrect data for the vcache
hash table.
2021-03-03 08:25:16 +00:00
ad
748d5a7e47 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.
2020-06-14 21:41:42 +00:00
ad
83f60fef8a pool_cache:
- make all counters per-CPU and make cache layer do its work with atomic ops.
- conserve memory by caching empty groups globally.
2020-06-14 21:34:25 +00:00
ad
ba90a6ba38 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.
2020-06-11 22:21:05 +00:00
ad
fdd120904c ncs_collisions is gone. 2020-03-23 18:44:17 +00:00
ad
1d7848ad43 Process concurrent page faults on individual uvm_objects / vm_amaps in
parallel, where the relevant pages are already in-core.  Proposed on
tech-kern.

Temporarily disabled on MP architectures with __HAVE_UNLOCKED_PMAP until
adjustments are made to their pmaps.
2020-03-22 18:32:41 +00:00
ad
134d380e04 - nchash is gone.
- Report new namecache stats.
2020-03-22 14:39:28 +00:00
simonb
65ffe24597 Fix alignment of Flags column for vmstat -mW. 2020-01-25 05:43:32 +00:00
ad
ada01d2fe1 vmstat -s: report new stats:
0 per-cpu stats one synced
     7246 per-cpu stats all synced
     4092 anon pages possibly dirty
     8881 anon pages dirty
        0 anon pages clean
       68 file pages possibly dirty
        0 file pages dirty
  2367889 file pages clean
2020-01-15 17:56:46 +00:00
ad
51ce3a6397 Show reverse misses too. 2020-01-08 11:58:02 +00:00
ad
71efd89793 - Report namecache reverse hits with vmstat -s.
- ncvhashtbl is no more.
2020-01-06 11:24:30 +00:00
mrg
66bc25587b move the time nlist fetches into their own namelist and only
fetch them when necessary.  allow for fallback uses of older
time sources if others are not present.

this stops vmstat from exiting if it can't get the addresses
of these time values it often doesn't need (eg, running kernels
use the sysctl method), which has cropped up recently wit the
removal of boottime variable.


a slighly modified version of this patch (modified to handle
the old boottime variable over the new one) works against a
netbsd-9 vmstat in -current too.

XXX: pullup
2020-01-04 03:09:55 +00:00
thorpej
45caeb7639 boottime in the kernel is no more. Instead, read timebasebin and convert
from bintime to timespec.
2020-01-03 19:13:54 +00:00
msaitoh
ba5c90c4a4 s/sucess/success/ in comment. 2019-12-27 09:45:26 +00:00
ad
93aed9560e Have vmstat -H report on vcache_hashtab. 2019-12-22 17:27:53 +00:00
christos
d275294e40 Expose struct namecache. 2019-09-13 13:56:04 +00:00
he
feecb28e70 Make the scaling of the "bytes written" sticky, so that if we go
to K, we don't return to unscaled, and similar for higher scales
(though it takes some effort, due to the wide field...)
Fixes PR#54334.
2019-06-30 19:57:23 +00:00
mrg
e288c0bcc9 when dumping a kernhist history replace "%s" with "%p" so that the
kernhist in kernel can be a little more usable without making the
userland dumping code crash.
2019-05-09 08:01:07 +00:00
simonb
e348c98d9c Use PRWORD for printing -m/-mW totals so fields don't run in to each other.
While here, update field widths for 'vmstat -mW' for modern machines.
2019-04-30 23:29:18 +00:00
sevan
66a1de5f19 Remove reference to Installing and Operating 4.3BSD paper, at present it's not
possible to find a paper titled as such with sections starting with
"Interpreting system activity".
There is a "Monitoring System Performance" section present from the 4.1BSD
Installing and Operating paper up to and including the 4.4BSD paper. The advice
in this section has not aged very well.
From "Installing and Operating 4.3BSD-tahoe UNIX on the VAX":
"Cumulatively on one of our large machines we average about 60-100
context switches and interrupts per second and about 70-120 system calls
per second"
2018-12-25 03:38:59 +00:00
sevan
a07b17440a typo 2018-12-13 01:58:04 +00:00
sevan
daf842171c Describe what happens when you run vmstat witout any options aka the first line
of vmstat.
2018-12-13 01:29:10 +00:00
sevan
fd25e7cfc8 Document vmstat -w -1 is accepted.
via FreeBSD.
2018-12-05 23:42:23 +00:00
sevan
92ffdc1d37 Suggest kernhist(9) which is required for vmstat -u and -U
Drop Pp before Bl while here.
2018-12-05 10:35:14 +00:00
dholland
32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
mrg
2c65d957b0 deref the right address to get the pool_allocator. 2017-12-04 03:05:57 +00:00
mrg
cd83415f42 remove now wrong comment. minor KNF. 2017-12-03 21:10:01 +00:00
mrg
67dafd4718 fix the kvm version of counting pool pages for vmstat -s. 2017-12-03 21:09:01 +00:00
mrg
277fd3d5f5 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.
2017-12-02 08:15:42 +00:00
pgoyette
64ae8753d8 Remove the ABI version-and-length check that was recently introduced;
sysctl(9) ABIs should be stable across versions.

XXX Pull-up to -8
2017-11-03 22:45:14 +00:00
pgoyette
cb32a134a5 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.
2017-10-28 00:37:11 +00:00
mlelstv
809af110e7 Don't print "nan" when there is no disk activity. 2017-09-06 06:05:23 +00:00
mlelstv
245a1a4599 Use I/O timestamps to compute disk statistics for better precision.
Disk statistics are collected in a fixed size array, that got corrupted
when a disk was detached. Adapt by skipping entries of detached disks
and detect reused disknames at the array end.
2017-07-04 21:19:33 +00:00
mlelstv
ba576b71a7 Enhance disk metrics by calculating a weighted sum that is incremented
by the number of concurrent I/O requests. Also introduce a new disk_wait()
function to measure requests waiting in a bufq.
iostat -y now reports data about waiting and active requests.

So far only drivers using dksubr and dk, ccd, wd and xbd collect data about
waiting requests.
2017-03-05 23:07:12 +00:00
ryo
55563c97ca "vmstat -ie[v]" auto fit to minimum columns
Reviewed by msaitoh@
2017-01-05 07:53:20 +00:00
pgoyette
c0a30d4dc7 Adapt to use of bintime(9) for kernel history timestamps (7.99.55). 2017-01-05 03:42:27 +00:00
pgoyette
09c45791e2 Fix error handling confusion between error and errno 2017-01-04 01:29:18 +00:00
pgoyette
394eed3eed Adapt to new version of the sysctl export structure 2017-01-04 01:06:26 +00:00
pgoyette
58e3ff39b3 Use appropriate PRI* format specifiers for fixed-bit-size numbers
Should fix i386 build.
2017-01-02 09:24:54 +00:00
pgoyette
ba8c50ff8b For kvm-based kernhist code, print size of history table and "next free"
pointer, same as we do for sysctl-based code.
2017-01-02 02:08:05 +00:00
pgoyette
6a4fc5e568 Restore the kvm-grovelling code for use on crash files (where sysctl(3)
is not available).  Otherwise, this would always report on the current
running kernel regardless of the use of -M option.
2017-01-02 01:48:56 +00:00
pgoyette
93058c7f3d For kernel history display, replace the kvm grovelling with the newly
available sysctl access to the history data.

XXX vmstat still uses kvm for several other displays
2017-01-02 01:02:19 +00:00
mrg
1383c0c74f build vmstat as n64 on mips64. only kernel histories and hash stats
need to be fixed fot this to be reverted.
2016-12-29 23:42:38 +00:00
christos
bb762fe5ee No point in using float here; makes evbmips64 need __truncdfsf2, and that
causes static linking issues because of softfloat.
2016-10-04 17:36:21 +00:00
sevan
39bbc68a3b Drop main() prototype. 2016-09-05 00:40:28 +00:00
christos
e33113ab6d Work around gcc on sparc64 bug 2016-03-06 18:01:28 +00:00
dennis
7ad3371ebc Update stats-keeping in sys/kern/vfs_cache.c to remove (most)
races while allowing consistent lockless sampling of the per-cpu
statistics without atomic operations.  Update comment describing
the locking protocol to include this.

These files were fumble-fingered out of the last commit.
2014-12-24 20:01:21 +00:00