Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: tmpfs sizing problems (i386, 4GB mem)


Antti Kantee wrote:
On Mon, Jun 28, 2010 at 04:17:45PM +0100, Mindaugas Rasiukevicius wrote:
Chris Ross<>  wrote:

    On a machine running 5.99.31, I'm having a problem with my tmpfs
/tmp.  I have it configured to be 600m in size, but it's only about
200m.  After trying to figure out if it was an argument parsing issue, I
have verified that if I just call "mount_tmpfs tmpfs /mnt" I get the
following (df -k output)

Investigating this problem.  It is due to "dynamic" calculation of the
limit from free memory.

On a tangent, I recently wanted to use large sparse files on /tmp
(which is 99.9% of the time one of {ffs,mfs,tmpfs}).  Since my host
doesn't have 8TB of memory, I ended up requiring a local mount of

I just fell onto another, probably unrelated problem with tmpfs
sizing.  My box normally runs with a tmpfs size of 4 GB.  This size
is correctly transferred into the kernel parameters for the fs.
However, in tmpfs_bytes_max, the returned value is the result of
a call to min with some computed value and this stored size.  This
routine is declared to return an int, and thus only the low half
of the 64 bit value is checked and returned, in my case a zero.
This leads shortly to a panic.

The attached patch fixed this for me.

--                         Wolfgang Solfrank
Index: sys/fs/tmpfs/tmpfs_mem.c
RCS file: /cvsroot/src/sys/fs/tmpfs/tmpfs_mem.c,v
retrieving revision 1.1
diff -u -r1.1 tmpfs_mem.c
--- sys/fs/tmpfs/tmpfs_mem.c    22 Jun 2010 18:32:07 -0000      1.1
+++ sys/fs/tmpfs/tmpfs_mem.c    28 Jun 2010 19:19:35 -0000
@@ -110,7 +110,7 @@
                freepages -= TMPFS_PAGES_RESERVED;
        avail_mem = round_page(mp->tm_bytes_used) + (freepages << PAGE_SHIFT);
-       return min(mp->tm_mem_limit, avail_mem);
+       return MIN(mp->tm_mem_limit, avail_mem);

Home | Main Index | Thread Index | Old Index