Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2012 19:49:04 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Patrick Mahan <PMahan@adaranet.com>
Cc:        "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: Need some explanation on a field in struct vmtotal
Message-ID:  <20120829164904.GD33100@deviant.kiev.zoral.com.ua>
In-Reply-To: <DA0D02C15AF8CF408F8A03D8FE5AD16C1777FDDA@SJ-EXCH-1.adaranet.com>
References:  <DA0D02C15AF8CF408F8A03D8FE5AD16C1777FDDA@SJ-EXCH-1.adaranet.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--WOMRmRCzG5HeB3RL
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Aug 29, 2012 at 09:09:17AM -0700, Patrick Mahan wrote:
> All,
>=20
> I'm trying to determine if this is a bug or for real.  We have a customer=
 that pointed his
> NMS at our appliance (running FBSD 9.0).  These are 64-bit intel platform=
s (8 core Xeons)
> with 8 Gbytes of RAM and a 16 Gbyte swap.
>=20
> The customer claims that the NMS shows him that these boxes have a tetrab=
yte of VM, which
> surprised him somewhat.  These platforms are using net-snmp 5.7.1 out of =
the ports tree.
>=20
> I did an snmpget query on one of our boxes here in our lab and saw the fo=
llowing:
>=20
> comet1# snmpget -v2c -c public localhost hrMemorySize.0
> HOST-RESOURCES-MIB::hrMemorySize.0 =3D INTEGER: 8351368 KBytes
>=20
>=20
> SNMP table: HOST-RESOURCES-MIB::hrStorageTable
>=20
> hrStorageIndex   hrStorageType  hrStorageDescr hrStorageAllocationUnits h=
rStorageSize hrStorageUsed hrStorageAllocationFailures
>=20
> ...
>=20
>      3  HOST-RESOURCES-TYPES::hrStorageVirtualMemory Virtual memory   409=
6 Bytes     269040967     268460681          0
>=20
> My understanding is that the 'hrStorageSize' is in 'hrStorageAllocationUn=
its', so the total
> byte size should be=20
>=20
>     4096 x 269040967 =3D 1085607800832
>=20
> Now, I have looked at the net-snmp code for retrieving this value and it =
seems to be=20
> via a sysctl to vm.vmtotal.  This value is the field t_vm in the vmtotal =
structure
> (defined in sys/sys/vmmeter.h).
>=20
> Looking at the code in sys/vm/vm_meter.c I see the following:
>=20
>         TAILQ_FOREACH(object, &vm_object_list, object_list) {
>                 /*
>                  * Perform unsynchronized reads on the object to avoid
>                  * a lock-order reversal.  In this case, the lack of
>                  * synchronization should not impair the accuracy of
>                  * the reported statistics.
>                  */
>                 if (object->type =3D=3D OBJT_DEVICE || object->type =3D=
=3D OBJT_SG) {
>                         /*
>                          * Devices, like /dev/mem, will badly skew our to=
tals.
>                          */
>                         continue;
>                 }
>                 if (object->ref_count =3D=3D 0) {
>                         /*
>                          * Also skip unreferenced objects, including
>                          * vnodes representing mounted file systems.
>                          */
>                         continue;
>                 }
>                 total.t_vm +=3D object->size;
>=20
> But I cannot find any description of what object->size is defined.  The
> vm_object structure is defined in vm/vm_object.h as type vm_pindex_t.
>=20
> Which is an architecturally defined in <machine>/_types.h (for amd64 this
> is defined as __uint64_t.
>=20
> My FreeBSD internals (McKusick's book) for 5.5 doesn't seem to reference =
it.
>=20
> So my question is -  Is the object->size in bytes?  If this is so, then
> total.t_vm is in bytes and net-snmp is using that value unmodified.  Inst=
ead
> it should divide that value by 4096 and report that number instead?
>=20
> Or is my understanding screwed up here?

struct vm_object size is in pages.

--WOMRmRCzG5HeB3RL
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)

iEYEARECAAYFAlA+SAAACgkQC3+MBN1Mb4hsJQCdFnFbnXHzVaL2GkOqubIrjOa4
tFoAnibY8O3fMkw6CsFT+L1NbNWyuHu+
=/R7D
-----END PGP SIGNATURE-----

--WOMRmRCzG5HeB3RL--



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