Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 May 2007 22:09:00 +0200
From:      Ulrich Spoerlein <uspoerlein@gmail.com>
To:        Peter Jeremy <peterjeremy@optushome.com.au>
Cc:        stable@freebsd.org
Subject:   Re: Change in memory tracking in recent 6-STABLE?
Message-ID:  <20070531200900.GB14269@roadrunner.q.local>
In-Reply-To: <20070528100752.GA1750@turion.vk2pj.dyndns.org>
References:  <20070528092905.GB1551@roadrunner.q.local> <20070528100752.GA1750@turion.vk2pj.dyndns.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Peter Jeremy wrote:
> On 2007-May-28 11:29:05 +0200, Ulrich Spoerlein <uspoerlein@gmail.com> wrote:
> >I'm using symon to monitor memory usage among several FreeBSD machines.
> >After updating to a recent 6-STABLE, the amount of memory no longer adds
> >up to the total physical memory. The "inactive" counter is way too
> >small.
> 
> As well as "active", "inactive" and "free", there is "cache", "wired"
> and "buffers".
> 
> Check the following sysctls:
> vfs.bufspace (bytes)
> vm.stats.vm.v_active_count (pages)
> vm.stats.vm.v_inactive_count (pages)
> vm.stats.vm.v_wire_count (pages)
> vm.stats.vm.v_cache_count (pages)
> vm.stats.vm.v_free_count (pages)

Hi Peter,

Ok, adding up vm.stats gives me the total physical RAM (roughly). One
question would be, where is the buffer cache counted towards? Or is it
spread all over the place?

Back to symon, it uses the following code to grab it's values. This has
worked fine till some months ago. Now it is missing several MBytes. How
should I fix the code?

static int me_vm_mib[] = {CTL_VM, VM_TOTAL};
...
    if (sysctl(me_vm_mib, 2, &me_vmtotal, &me_vmsize, NULL, 0) < 0) {
        warning("%s:%d: sysctl failed", __FILE__, __LINE__);
        bzero(&me_vmtotal, sizeof(me_vmtotal));
    }

    /* convert memory stats to Kbytes */
    me_stats[0] = pagetob(me_vmtotal.t_arm);
    me_stats[1] = pagetob(me_vmtotal.t_rm);
    me_stats[2] = pagetob(me_vmtotal.t_free);

Why are these values not adding up to 256MB in my case?

Ulrich Spoerlein
-- 
"The trouble with the dictionary is you have to know how the word is
spelled before you can look it up to see how it is spelled."
-- Will Cuppy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070531200900.GB14269>