Per-CPU VFS Namecache Effectiveness Statistics:
* Convert nchstats into a CPU indexed array
* Export the per-CPU nchstats as a sysctl vfs.cache.nchstats
and let user-land aggregate them.
* Add a function called kvm_nch_cpuagg() to libkvm; it is
shared by systat(1) and vmstat(1) and the ncache-stats test
program. As the function name suggests, it aggregates
the per-CPU nchstats.
* Move struct nchstats into a separate header to avoid
header file namespace pollution; sys/nchstats.h.
* Keep a cached copy of the globaldata pointer in the VFS
specific LOOKUP op, and use that to increment the
namecache effectiveness counters (nchstats).
* Modify systat(1) and vmstat(1) to accomodate the new
behavior of accessing nchstats. Remove a (now) redundant
sysctl to get the cpu count (hw.ncpu), instead we just divide
the total length of the nchstats array returned by sysctl
by sizeof(struct nchstats) to get the CPU count.
* Garbage-collect unused variables and fix nearby warnings
in systat(1) an vmstat(1).
* Add a very-cool test program, that prints the nchstats
per-CPU statistics to show CPU distribution. Here is the
output it generates on an 2-processor SMP machine:
gray# ncache-stats
VFS Name Cache Effectiveness Statistics
4207370 total name lookups
COUNTER CPU-1 CPU-2 TOTAL
goodhits 2477657 1060677 (3538334 )
neghits 107531 47294 (154825 )
badhits 28968 7720 (36688 )
falsehits 0 0 (0 )
misses 339671 137852 (477523 )
longnames 0 0 (0 )
passes 2 13104 6813 (19917 )
2-passes 25134 15257 (40391 )
The SMP machine used for testing this commit was proudly presented
by David Rhodus <drhodus@dragonflybsd.org>.
Reviewed-by: Matthew Dillon <dillon@backplane.com>
15 files changed: