From owner-freebsd-questions@FreeBSD.ORG Mon Jan 12 23:10:33 2015 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 43576C5B for ; Mon, 12 Jan 2015 23:10:33 +0000 (UTC) Received: from mail-pa0-x22c.google.com (mail-pa0-x22c.google.com [IPv6:2607:f8b0:400e:c03::22c]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1077AC91 for ; Mon, 12 Jan 2015 23:10:33 +0000 (UTC) Received: by mail-pa0-f44.google.com with SMTP id et14so34694616pad.3 for ; Mon, 12 Jan 2015 15:10:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=BII5YJXfsuZ9M7jKVPCmEn7q5W1BSlzwpnxnBvKXtIo=; b=NveianUdPF5gzSeP239ROO8VvMTcqPIsmeDl99uU/jVvD42Lf4Zexw7kZlkfANaIVz FdaFFIqzQKC6W87/fF20Y7CKqsmQcXQNL8mgBBB58cs/jhb5fP1gnhbvT0DAIWn7TxA2 QXJ6mr9IZooItTdwISiHxTMgW9Rj2OrDUkles0fqMAGgNuhIFzopqY9T2lIHhbKdw4CT pWOOwRApsn1O042Hj0g2VoIKCSmow7VycPkwwUtaj0+bDaoCGI7Kp6NKZt+KiVuP+5U1 jJVUH9Zf8y0AxH2FzmnpL+XcdHrKx5Uoo6nAppRLQqSuesrnPHEOqm0kTNQQeO7mTXja n1lw== X-Received: by 10.68.69.106 with SMTP id d10mr47265453pbu.60.1421104232604; Mon, 12 Jan 2015 15:10:32 -0800 (PST) Received: from [192.168.0.86] (c-50-186-4-10.hsd1.or.comcast.net. [50.186.4.10]) by mx.google.com with ESMTPSA id c17sm15308209pdl.6.2015.01.12.15.10.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jan 2015 15:10:31 -0800 (PST) Message-ID: <54B45465.7040501@gmail.com> Date: Mon, 12 Jan 2015 15:10:29 -0800 From: Lacey Powers User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: freebsd-questions@freebsd.org Subject: Calculating Dirty Memory Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2015 23:10:33 -0000 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. 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 Based on notes from here: https://www.freebsd.org/doc/en/articles/vm-design/article.html#freeing-pages Does that seem correct? Is there a better way to determine this metric? Thank you for your time and assistance, Lacey