Subject: Re: MFS vs TMPFS
To: Marcin Jessa <lists@yazzy.org>
From: Simon Burge <simonb@wasabisystems.com>
List: current-users
Date: 10/04/2005 11:54:48
Marcin Jessa wrote:

> What would be the advantages of using tmpfs over mfs as memory file
> system? 
> Say I want to mount my /tmp as tmpfs instead of mfs, would that be a
> good thing to do?
> Or I would like to rather mount a file systems on a LiveCD or my
> embedded device as tmpfs instead of mfs, would that also have any impact
> on the system ?

I just tried a couple of tests on -current i386 that was pretty much

	"vmstat ; mount_foo ; <command> ; vmstat ; unmount ; vmstat"

for the following commands:

- sh MAKEDEV all (lots of devices)

    mfs   used  1264 kB or   316 pages (df said    33 kB used)
    tmpfs used   308 kB or    77 pages (df said   308 kB used)

- extract some etexts from a tar file (a few big files)

    mfs   used 20776 kB or  5194 pages (df said  9379 kB used)
    tmpfs used  9108 kB or  2277 pages (df said  9108 kB used)

- extract some pkgsrc directories from a tar file (lots of little files)

    mfs   used 79292 kB or 19823 pages (df said 24991 kB used)
    tmpfs used 54060 kB or 13515 pages (df said 54060 kB used)

Tests were run multiple times until the free memory figures for the
first and last vmstat commands matched, ensuring that there was no extra
memory taken up in (say) the buffer cache by running the given command.

Two interesting points:

 1- tmpfs is the obvious winner in terms of memory used.

 2- mfs lies a little about how much memory is actually used (vis
    the df figure vs the amount of actual memory used).

Cheers,
Simon.
--
Simon Burge                            <simonb@wasabisystems.com>
NetBSD Support and Service:         http://www.wasabisystems.com/