Subject: Re: free space (was /dev) on tmpfs problem
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Daniel Carosone <dan@geek.com.au>
List: tech-kern
Date: 11/14/2005 11:32:18
--33c4aGQrRAPGVH9y
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Nov 14, 2005 at 11:08:24AM +1100, Daniel Carosone wrote:
> > because the desired size of tmpfs can not be calculated from
> > the total amount of memory.
>=20
> To me, its "all memory+swap not otherwise in use for something else,
> up to the -s limit if specified".  As these things change, so does the
> size of tmpfs (as seen in df).

I mean that this is my expectation of how I want a tmpfs to work.

> > filemin/max is not related.
>=20
> Not in implementation now, no.  But the issue is that they're another
> example of "all memory not in use for something else", and the two
> uses are conflicting.
>=20
> My point is simply to suggest that tmpfs recognise this other usage,
> and not consider clean filecache pages used for the purpose of
> freespace/size reporting.=20

Let's give a clearer example.  On a relatively freshly booted system:

Filesystem  1K-blocks      Used     Avail Capacity  Mounted on
tmpfs         2995780        16   2995764     0%    /tmp

Then after I cksum some large files, reading them into filecache:

Filesystem  1K-blocks      Used     Avail Capacity  Mounted on
tmpfs         2618296        16   2618280     0%    /tmp

meanwhile, pstat still shows 0 used swap:

Device      1K-blocks     Used    Avail Capacity  Priority
/dev/cgd0b    2621440        0  2621440     0%    0

If I swapctl -d, df shows:

Filesystem  1K-blocks      Used     Avail Capacity  Mounted on
tmpfs              16        16         0   100%    /tmp

And trying to create a small file in /tmp gets ENOSPC. Put back the
swap, and I can create the small file:

Filesystem  1K-blocks      Used     Avail Capacity  Mounted on
tmpfs         2617968        20   2617948     0%    /tmp

Still I have no swap used, so those pages have come from something
else, presumably file cache or free pool until the pagedaemon runs.

So there are two problems:
 1. tmpfs is not reporting free space sanely for df
 2. tmpfs is apparently not allowing itself to compete with file cache
    for free-memory resources.

In another post, I ask whether these are the same problem.  It looks
to me, from the user perspective, like they are.

--
Dan.


--33c4aGQrRAPGVH9y
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)

iD8DBQFDd9sSEAVxvV4N66cRAl1JAJ0a8DUwGbAn61ltjZ8DnocJR94tlACgsPQb
G7KCwPxxwd8rypw2d01kCew=
=eD70
-----END PGP SIGNATURE-----

--33c4aGQrRAPGVH9y--