Date: Thu, 29 Mar 2012 21:49:41 +0200 From: "O. Hartmann" <ohartman@zedat.fu-berlin.de> To: David Wolfskill <david@catwhisker.org> Cc: Current FreeBSD <freebsd-current@freebsd.org>, utisoft@gmail.com Subject: Re: Using TMPFS for /tmp and /var/run? Message-ID: <4F74BCD5.4040609@zedat.fu-berlin.de> In-Reply-To: <20120329161452.GZ1709@albert.catwhisker.org> References: <4F746F1E.6090702@mail.zedat.fu-berlin.de> <20120329161452.GZ1709@albert.catwhisker.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig91C60E80BB0E531968B7EA00 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Am 03/29/12 18:14, schrieb David Wolfskill: > On Thu, Mar 29, 2012 at 04:18:06PM +0200, O. Hartmann wrote: >> I was wondering if there are some objections using TMPFS for /tmp and >> /var/run. >> ... >> My question is whether there are objections using TMPFS for bot /tmp/ >> and /var/run/ at this stage on FreeBSD 10.0-CURRENT/amd64? >> .... >=20 > I have no experience using tmpfs for /var/run, but I have been using it= > for /tmp for some time (mostly in i386, though). >=20 > While I use it quite successfully on machines with a small number of > folks actively busy -- e.g., my desktop; my laptop; my home machines), = I > encountered some issues when I tried to do so on machines that were > intended for significantly "heavier" use. Specifically: >=20 > * Compared to an md-resident /tmp, a tmpfs-resident /tmp has much less > flexibility for specifying the size. Per mdconfig(8), the former > uses: >=20 > -s size > Size of the memory disk. Size is the number of 512 byte s= ectors > unless suffixed with a b, k, m, g, or t which denotes byte= , kilo- > byte, megabyte, gigabyte and terabyte respectively. Option= s -a > and -t swap are implied if not specified. >=20 > while the latter uses: >=20 > size Specifies the total file system size in bytes. If zero (t= he > default) or a value larger than SIZE_MAX - PAGE_SIZE is gi= ven, > the available amount of memory (including main memory and = swap > space) will be used. >=20 > In this configuration, I would have preferred to have specified > about 10GB for /tmp. I wouldn't mind if it spilled to swap space, > but I certaianly didn't want it using 10GB of RAM -- especially since= > the machines only had 6GB RAM. >=20 > Nor did I especially want *all* of the swap space used for /tmp. I > would have allocated (say) 20GB for swap. I wouldn't mind if half of= > that were used for /tmp -- but a reason I allocate so much swap is > that I've seen what happens when a machine runs out of swap, and it > wasn't pretty. >=20 >=20 > In any case, effective maximum usable size for tmpfs involves SIZE_MA= X > (~4G) & PAGE_SIZE (4K, in my case). >=20 > * 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. >=20 > So I continue to use tmpfs for /tmp for machines with fewer folks > logging in, but I'm a bit less enthusiastic about its use unless the > workload and other requirements are fairly carefully considered > beforehand. >=20 > Peace, > david 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. On the other hand - my view of those things is really naiv. I think having tmpfs isn't even a benefit in terms of security, it should also offer a speedy access to files kept in memory, doesn't it? Linux is using TMPFS filesystems a lot for these purposes. How do they overcome restrictions of the size or not flloding RAM and/or swap? Regards, Oliver --------------enig91C60E80BB0E531968B7EA00 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJPdLzcAAoJEOgBcD7A/5N8xsAIAKg+CrYfXt2CKC+nXyY8ZXHt IdeOQP6pIdwJn/p/Gppu+Z/gyGVka2vk7/qN7kux8NWPn/b6EKrs9rRSDpiEAT+K oyptocOqpaD5Y8960zJoDS0xjuF1XUogAkInByi55VQlT5zbIpqpVvQzIQu9TRZ/ S1WYm2Z81+aP795K3U8wniAhV3Dplzw5Zi1fio/AUbxkO+kV2ZEfjm+Am8IBtzXg h5Y5xm9bgsZl65y+oyObpXHFD2PCWmC8a9xixfCJjoHa9WTIwyXW3k33tvPOHEbX FFkgPEe6lB/CTGCqlvO31FsoHhmB1YRNs/ccHFKoXgV7q8tXLpbYigIZOpDiymE= =cy/J -----END PGP SIGNATURE----- --------------enig91C60E80BB0E531968B7EA00--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F74BCD5.4040609>