diff options
author | bmilekic <bmilekic@FreeBSD.org> | 2001-07-26 18:47:46 +0000 |
---|---|---|
committer | bmilekic <bmilekic@FreeBSD.org> | 2001-07-26 18:47:46 +0000 |
commit | 0caeab3ccdc5926c530383c04c96653559f47400 (patch) | |
tree | c92cd4663cb459d84696efa19cbdcbe5005277c8 /usr.bin/systat | |
parent | d3c6cce7de3c0e2296ad3aaaec504d56bd72ca1b (diff) | |
download | FreeBSD-src-0caeab3ccdc5926c530383c04c96653559f47400.zip FreeBSD-src-0caeab3ccdc5926c530383c04c96653559f47400.tar.gz |
- Do not handle the per-CPU containers in mbuf code as though the cpuids
were indices in a dense array. The cpuids are a sparse set and treat
them as such, setting up containers only for CPUs activated during
mb_init().
- Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse
map, in accordance with the above.
This allows us to properly boot with certain CPUs disactivated. However, if
we later decide to re-activate said CPUs, we will barf until we decide to
implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU
containers to get configured on their activation.
Reported by: mjacob
Partially (sys/ diffs) Submitted by: mjacob
Diffstat (limited to 'usr.bin/systat')
-rw-r--r-- | usr.bin/systat/mbufs.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/systat/mbufs.c b/usr.bin/systat/mbufs.c index df53e0c..1983e0a 100644 --- a/usr.bin/systat/mbufs.c +++ b/usr.bin/systat/mbufs.c @@ -50,7 +50,7 @@ static const char rcsid[] = #include "extern.h" static struct mbpstat **mbpstat; -static int num_objs, ncpu; +static int num_objs; #define GENLST (num_objs - 1) /* XXX: mbtypes stats temporarily disabled. */ @@ -150,8 +150,11 @@ showmbufs() * Print total number of free mbufs. */ totfree = mbpstat[GENLST]->mb_mbfree; - for (i = 0; i < ncpu; i++) + for (i = 0; i < (num_objs - 1); i++) { + if (mbpstat[i]->mb_active == 0) + continue; totfree += mbpstat[i]->mb_mbfree; + } j = 0; /* XXX */ if (totfree > 0) { mvwprintw(wnd, 1+j, 0, "%-10.10s", "free"); @@ -189,12 +192,6 @@ initmbufs() } nmbtypes = mbtypeslen / sizeof(*m_mbtypes); #endif - len = sizeof(int); - if (sysctlbyname("kern.smp.cpus", &ncpu, &len, NULL, 0) < 0 && - sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0) < 0) { - error("sysctl getting number of cpus"); - return 0; - } if (sysctlbyname("kern.ipc.mb_statpcpu", NULL, &len, NULL, 0) < 0) { error("sysctl getting mbpstat total size failed"); return 0; |