Date: Mon, 18 Feb 2019 21:27:13 +0000 (UTC) From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344269 - head/lib/libmemstat Message-ID: <201902182127.x1ILRDJL055771@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: glebius Date: Mon Feb 18 21:27:13 2019 New Revision: 344269 URL: https://svnweb.freebsd.org/changeset/base/344269 Log: With r343051 UMA switched from atomic counts to counter(9) and now kernel reports snap counts of how much a zone alloced and how much it freed. It may happen that snap values doesn't match, e.g alloced - freed < 0. Workaround that in memstat library. Reported by: pho Modified: head/lib/libmemstat/memstat_uma.c Modified: head/lib/libmemstat/memstat_uma.c ============================================================================== --- head/lib/libmemstat/memstat_uma.c Mon Feb 18 20:29:19 2019 (r344268) +++ head/lib/libmemstat/memstat_uma.c Mon Feb 18 21:27:13 2019 (r344269) @@ -213,6 +213,15 @@ retry: mtp->mt_numfrees += upsp->ups_frees; } + /* + * Values for uth_allocs and uth_frees frees are snap. + * It may happen that kernel reports that number of frees + * is greater than number of allocs. See counter(9) for + * details. + */ + if (mtp->mt_numallocs < mtp->mt_numfrees) + mtp->mt_numallocs = mtp->mt_numfrees; + mtp->mt_size = uthp->uth_size; mtp->mt_rsize = uthp->uth_rsize; mtp->mt_memalloced = mtp->mt_numallocs * uthp->uth_size;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902182127.x1ILRDJL055771>