Using TMPFS for /tmp and /var/run?

David Wolfskill david at
Mon Apr 2 10:59:34 UTC 2012

On Mon, Apr 02, 2012 at 01:31:19PM +0300, Gleb Kurtsou wrote:
> ...
> > >   In any case, effective maximum usable size for tmpfs involves SIZE_MAX
> > >   (~4G) & PAGE_SIZE (4K, in my case).
> size_t is 64-bit on 64-bit archs.

OK.  Still, the requirement that the "size" specification be in "bytes"
is awkward (in my experience) -- and I was using i386.

> > > * Even when I went ahead and created a tmpfs for /tmp, I'd get ENOSPC
> > >   whenever I tried to allocate anything on it -- until I dropped the
> > >   size specification to <2G (2**32).  Well, 2GB for /tmp just wasn't at
> > >   all likely to be useful for my purposes in this case.
> Are you using ZFS alongside tmpfs? It should be fixed in 9-STABLE.

I have not tried ZFS yet.  I don't expect to do so unless I switch to

> ...
> > It seems there is only one switch which determines the size of the tmpfs
> > in question (size) and there is no convenient way to say what amount of
> > RAM is being used before using the swap space. I'd like to have at least
> > a knob determining the limit of RAM being used.
> There is no way to force tmpfs to use given amount of RAM only. It's VM
> subsystem that decides what pages to swap. Although some tweaking for VM
> to prefer swapping tmpfs pages prior to process pages would be nice.
> You could try the patch attached. It adds support for size option suffixes
> (like 1g) and introduces swap limit (part of the older patch, not sure
> if it's any use).
> Patch is against 10-CURRENT.
> Older version:
> ...

I'll plan to try this on a currrently-underutilized slice on my laptop,
then -- thanks! :-)

David H. Wolfskill				david at
Depriving a girl or boy of an opportunity for education is evil.

See for my public key.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url :

More information about the freebsd-current mailing list