Commit Graph

242 Commits

Author SHA1 Message Date
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
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 a07b17440a typo 2018-12-13 01:58:04 +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
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
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
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
skrll f6dcbec3a9 Trailing whitespace. 2014-09-12 16:25:55 +00:00
skrll e52f4ab9a5 Print the cpu in the kernhist record. 2014-09-12 16:25:29 +00:00
nakayama 653203959c Use u_long to avoid negative value outputs. 2014-07-12 20:04:31 +00:00
joerg 99d9473857 Init summary counters. 2014-06-14 04:06:54 +00:00
joerg 11e7f587a5 Fix format string for ILP32. 2014-06-14 01:26:59 +00:00
joerg 67c88a0d78 Use kern.pool for the live system. 2014-06-13 19:10:01 +00:00
joerg 6cf722d5a8 GC left-over kread. 2014-06-03 21:56:30 +00:00
joerg 472ed4a521 Use CPU statistics from uvmexp when possible. 2014-06-03 21:56:03 +00:00
joerg 201b45ebb5 Use kern.clockrate if possible. 2014-06-03 21:45:41 +00:00
joerg 100b00cbbc Convert the remaining uvmexp users to the sysctl as default source. 2014-06-03 21:41:56 +00:00
joerg 5b23be7ac8 Use vm.uvmexp data as much as possible for vmstat -s.
Temporarily disable shadowing warning until the other users are cleaned
up.
2014-06-03 21:31:54 +00:00
joerg 94adc2671a Provide sysctl for namecache statistics. 2014-06-03 21:16:15 +00:00
joerg 8670ce0cf0 Make missing kern.evcnt an error, don't try to fallback to kmem use. 2014-06-02 19:16:10 +00:00