Calculating Dirty Memory

RW rwmaillists at googlemail.com
Tue Jan 13 01:41:58 UTC 2015


On Mon, 12 Jan 2015 15:10:29 -0800
Lacey Powers wrote:

> Hello Everyone,
> 
> I was working on trying to improve some database benchmarking tools
> for PostgreSQL, to work better on FreeBSD.
> 
> One of the things that the tools do under Linux is
> read /proc/meminfo, and grab the value of the Dirty parameter, which
> is this:
> 
> "Dirty ? The total amount of memory, in kilobytes, waiting to be
> written back to the disk." according to the CentOS documentation and
> other sources.

AFAIK the word "dirty" can refer to any page that isn't synchronized
with it's backing store, including swap-backed memory that may never be
written to disk.

> Poking around the FreeBSD documentation, Google, and sysctls, I came
> to this calculation:
> 
> (vm.stats.vm.v_page_size * vm.stats.vm.v_inactive_count) / 1024 = 
> Inactive (Dirty) kB  (page size in bytes *number of pages) / 1024


v_inactive_count includes dirty and clean pages.


More information about the freebsd-questions mailing list