Subject: Re: /dev on tmpfs problem
To: YAMAMOTO Takashi <firstname.lastname@example.org>
From: Daniel Carosone <email@example.com>
Date: 11/14/2005 10:07:38
Content-Type: text/plain; charset=us-ascii
On Mon, Nov 14, 2005 at 07:43:00AM +0900, YAMAMOTO Takashi wrote:
> > Plus, -s is the wrong way around. That's an upper limit on the size
> > of files you can store in tmpfs. The problem here is the reverse - not
> > having enough free space reported in tmpfs because filecache (or some
> > other better use of the memory) gobbled it all in the meantime.
> can you explain how it's the reverse?
The problem can occur no matter how much space is presently in use by
tmpfs; putting an upper bound on that use won't help because we might
have this problem long before we get to that upper bound - even when
tmpfs is ~empty.
> without trusting -s option, tmpfs have no way to know how much memory
> it can grab.=20
Ok. I wasn't sure what your 'trusting' comment was about before, but
you use it to mean that tmpfs also assumes it will be able to allocate
up to that bound. I'm not sure I like that, since it fails to provide
the necessary feedback via ENOSPC when the system/swap is approaching
full from other memory uses. At best, if we want tmpfs to behave this
way, it should be a different option perhaps.
> note that allocating memory for tmpfs implies
> reclaiming other use of memory including file cache.
Indeed. Since that has to happen anyway, why do we need another knob?
Is there a reason tmpfs can't consider (clean) filecache pages above
filemin or filemax as "free" for it's purposes (assuming no explicit
-s was given, of course)? Perhaps there is a reason, like we can't
sleep for free pages at the relevant point, but if that's so I can't
see that tmpfs can work even with swap.
This makes a very clear concept for the user: vm.file* pages are to be
used for filecache, and tmpfs looks just like filecache but backed by
swap rather than files. Therefore, dirty tmpfs pages should reclaim
clean filecache pages. If there's swap to back them, idle tmpfs pages
should eventually get cleaned and the space reused for more active
files or other needs.
If I use tmpfs with no backing swap, I have to recognise that I might
fill my filecache memory with tmpfs files that can't be paged out, and
thus starve myself of other cache or memory needs; I can use -s to
limit the size allocated to tmpfs to help here, if I want. What I
don't expect, and what seems to be happening here, is for clean
filecache data to prevent me using the memory for dirty tmpfs pages.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (NetBSD)
-----END PGP SIGNATURE-----