Date: Sat, 20 Nov 2004 22:57:30 +1100 (EST) From: Bruce Evans <bde@zeta.org.au> To: Ruslan Ermilov <ru@FreeBSD.org> Cc: amd64@FreeBSD.org Subject: Re: Too many mbufs Message-ID: <20041120225023.V86199@delplex.bde.org> In-Reply-To: <20041119204208.GA92096@ip.net.ua> References: <Pine.BSF.4.60.0411191757010.75856@mail.sbb.co.yu> <bf8d7e4904111912214a86a151@mail.gmail.com> <20041119204208.GA92096@ip.net.ua>
index | next in thread | previous in thread | raw e-mail
On Fri, 19 Nov 2004, Ruslan Ermilov wrote:
> On Fri, Nov 19, 2004 at 03:21:44PM -0500, Chris McDermott wrote:
> ...
> > If I try and get the value with sysctlbyname() [copied from
> > netstat/mbuf.c], it returns negative values for mbstat->m_mbufs. This
> > negative value does fluctuate with network usage though...
> >
> > Test code:
> > ...
> > if (sysctlbyname("kern.ipc.mbstat", mbstat, &mlen, NULL, 0) < 0)
> > perror("sysctl: retrieving mbstat");
> >
> > printf("mbufs: %d \nclusters: %d\n", mbstat->m_mbufs, mbstat->m_mclusts);
> >
> > return 0;
> > }
> >
> Your code is broken. Both m_mbufs and m_mclusts are of the type
> u_long, so they should be printed with "%lu" specifier. Fix your
> program and try again. (And you should see the same big number.)
>
> > Output:
> >
> > mbufs: -2240
> > clusters: -2686
> > ..
> > codefactory# netstat -m
> > 18446744073709549940 mbufs in use
> > 18446744073709549630/17152 mbuf clusters in use (current/max)
The value is obviously negative (since 1844mumble is nearly 2^64),
so the buggy program accidentally displays the correct value.
I can't see why the count would be decremented below 0 more on 64-bit
machines than on 32-bit ones.
Bruce
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041120225023.V86199>
