Commit Graph

339 Commits

Author SHA1 Message Date
ad c8c055b33a uidinfo is an SLIST. 2023-09-09 20:13:54 +00:00
simonb a8aadf9eaa For vmstat -mW, add a total KB consumed column and widen a couple of
other fields.
2023-08-01 04:20:14 +00:00
simonb ea450ca61b Remove extraneous "d" in a printf format string in UVM history dump
(leftover int format specifier from conversion to FMTd32?).
2022-10-23 23:30:31 +00:00
simonb e199a132f4 When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.
2022-07-16 10:36:19 +00:00
simonb 4b1956fe3e Move the call to getnlist() to after we check if kvm_openfiles(3) succeeded.
Avoids a coredump when called with "vmstat -M /dev/mem".
2022-07-16 09:32:27 +00:00
simonb b153c5598f Bump some column widths for "vmstat -mW". 2022-05-19 13:57:03 +00:00
rillig 0eb316d78b vmstat: unexport file-scope variable numdisks
There is no need to make this variable externally visible.  There are
several more variables in this file that could be unexported, leave
these for someone who knows whether vmstat.c is used by other parts of
the tree as well.

No functional change, OK mrg.
2022-02-27 19:00:46 +00:00
wiz 0e821de497 Fix typo in usage. 2022-02-09 07:51:45 +00:00
mrg aac8c56e2d allow the number of disks displayed in the default output
to be controlled.
2022-02-09 07:34:08 +00:00
mrg e2b62dbb1e when picking which 2 disks to show in the 'vmstat' default output
and they haven't been specified on the command line, pick the two
devices that have had the largest read+write IO bytes count.
2022-02-01 09:18:07 +00:00
simonb 80f785edc2 Update -m description to reflect reality. Kernel dynamic memory tracking
was removed long ago; only pool usage is reported.
2021-12-13 08:19:12 +00:00
rillig 1d6b489c6e usr.bin: remove unnecessary CONSTCOND, lint no longer needs it
Since 2021-01-31, lint no longer requires a CONSTCOND comment in a
do-while-0 statement since this is a common code pattern, especially in
statement-like macros.
2021-11-27 22:16:41 +00:00
rillig 581d109b89 usr.bin: enable lint checks for most programs in /usr/bin
Previously, lint was only activated for the libraries, but not for the
kernel or userland programs.  Activate lint for the programs in /usr/bin
for now, more will follow later.

This only affects builds that set MKLINT=yes.
2021-08-22 22:24:11 +00:00
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