From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <48EA3158.4040204@ge.com> Date: Mon, 06 Oct 2008 17:40:08 +0200 From: Gregoire Banderet MIME-Version: 1.0 To: Linuxppc-embedded@ozlabs.org Subject: Free memory, include "cached"? Content-Type: text/plain; charset=ISO-8859-1; format=flowed List-Id: Linux on Embedded PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hello, I have to report the amount of FreeMem on my embedded system. The rootfs is in RAM. I use /proc/meminfo. I started by doing : freemem = MemFree + Buffers + Cached But I realized (tell me if I'm wrong) that my rootfs filesystems is counted in "Cached". Part of the memory in "Cached" can be allocated, so I should add it as Free Memory, but part of it is my rootfs (i.e. really used). How should I compute freemem ? Note that with linux 2.4 (initrd and not initramfs) I did use the ioctl BLKGETSIZE in order to subtract the amount of memory used by the rootfs. But now with initramfs it's dynamic. Thanks, Greg