From owner-freebsd-current@FreeBSD.ORG Mon Apr 2 21:03:31 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 02B67106566C for ; Mon, 2 Apr 2012 21:03:31 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 77E878FC0C for ; Mon, 2 Apr 2012 21:03:30 +0000 (UTC) Received: by bkcjc3 with SMTP id jc3so3476147bkc.13 for ; Mon, 02 Apr 2012 14:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=mlP9sOyBIKpa+cm8cdE3A+ygFtLD42BRH3HGvj+DzYk=; b=0CMbUtEhTajZnkmDz9xF7BhI0JKNC2hlH8uoE4vdRz1DmjXpqGTk0gdDf7nkOEHfAf UXZjm0KteSAsbzaawBXkFuzK9DCaFeUcL5ypwcdi895ExDXvXuYMV6KXtfIJHdfn9P39 c+Zx7pRkTmTHq1H1wWYZT76kxVennRz8f1cS1SnSpB3SFhhSdlOKDCz08JnmGAeCPjHJ Vg2W7KFGnDKyLALGuhWCgMsV3OCZulqFLCbPF0jbQLfyTW+TrODcQrG8WAbqaONSDl7O 6Igb1xQN/7hwuRFZwWmaFOZLA8C/UWskd87EeJdgbAfMndJQ8uv8FoTS3ZrtyeDT8d54 BxlA== Received: by 10.204.9.194 with SMTP id m2mr4238779bkm.92.1333400609385; Mon, 02 Apr 2012 14:03:29 -0700 (PDT) Received: from localhost ([78.157.92.5]) by mx.google.com with ESMTPS id x4sm41152091bkv.8.2012.04.02.14.03.27 (version=SSLv3 cipher=OTHER); Mon, 02 Apr 2012 14:03:28 -0700 (PDT) Date: Tue, 3 Apr 2012 00:03:26 +0300 From: Gleb Kurtsou To: David Wolfskill Message-ID: <20120402210326.GA6364@reks> References: <4F746F1E.6090702@mail.zedat.fu-berlin.de> <20120329161452.GZ1709@albert.catwhisker.org> <4F74BCD5.4040609@zedat.fu-berlin.de> <20120402103119.GA2389@reks> <20120402132659.GF1420@albert.catwhisker.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4" Content-Disposition: inline In-Reply-To: <20120402132659.GF1420@albert.catwhisker.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Current FreeBSD Subject: Re: Using TMPFS for /tmp and /var/run? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Apr 2012 21:03:31 -0000 --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On (02/04/2012 06:26), David Wolfskill wrote: > On Mon, Apr 02, 2012 at 01:31:19PM +0300, Gleb Kurtsou wrote: > > ... > > 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: https://github.com/glk/freebsd-head/commit/3bd8f7d > > .... > > OK; here's a summary of what I found so far, now running: > > FreeBSD g1-227.catwhisker.org 10.0-CURRENT FreeBSD 10.0-CURRENT #0 233772M: Mon Apr 2 05:42:48 PDT 2012 root@g1-227.catwhisker.org:/usr/obj/usr/src/sys/CANARY i386 > > * First, the patch applied cleanly (via "patch -p1"). > > * Resulting sources build with no issues. > > * Prior specification I had in /etc/fstab: > > tmpfs /tmp tmpfs rw,size=2147483648 0 0 > > worked same as before the patch; "df -h /tmp" reported a size of 2.0G. > > * Changing the above to read: > > tmpfs /tmp tmpfs rw,size=2g 0 0 > > also provided the same result, so the unit-specification code looks > as if it's working as expected. > > * I have 20G specified for swap, and 4G RAM (and, as above, I'm running > i386). Changing the above tmpfs line in /etc/fstab to > > tmpfs /tmp tmpfs rw,size=8g 0 0 > > (still) yields: > > g1-227(10.0-C)[3] df -h /tmp > Filesystem Size Used Avail Capacity Mounted on > tmpfs 23G 12k 23G 0% /tmp > g1-227(10.0-C)[4] tmpfs-32bit-size_max.patch.txt should fix the problem. I don't have i386 installations to test it myself. Do you run PAE kernel? Could you try filling up /tmp at least to 10g. > > (Yes, I'm using a whopping total of 12kB while running X. I know of > *very* few folks who use the window manager I prefer. :-}) > > I'll try exercising it a bit during the day at work & report anything > noteworthy. But so far, I see no evidence of regression, and there is > some measure of usability improvement (IMO). So it's looking > encouraging. :-) > > Peace, > david > -- > David H. Wolfskill david@catwhisker.org > Depriving a girl or boy of an opportunity for education is evil. > > See http://www.catwhisker.org/~david/publickey.gpg for my public key. --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="tmpfs-32bit-size_max.patch.txt" commit 44f68235e23ab4bababeafe07d31e07feabb84ba Author: Gleb Kurtsou Date: Tue Apr 3 00:02:33 2012 +0300 tmpfs: Support file system sizes up to 4GB*PAGE_SIZE on 32 bit archs diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c index 29f2ca4..6b3ecc0 100644 --- a/sys/fs/tmpfs/tmpfs_vfsops.c +++ b/sys/fs/tmpfs/tmpfs_vfsops.c @@ -233,17 +233,13 @@ tmpfs_mount(struct mount *mp) * allowed to use, based on the maximum size the user passed in * the mount structure. A value of zero is treated as if the * maximum available space was requested. */ - if (size_max < PAGE_SIZE || size_max > SIZE_MAX - PAGE_SIZE) + if (size_max < PAGE_SIZE || size_max > UINT64_MAX - PAGE_SIZE || + (SIZE_MAX < UINT64_MAX && size_max / PAGE_SIZE >= SIZE_MAX)) pages = SIZE_MAX; else pages = howmany(size_max, PAGE_SIZE); MPASS(pages > 0); - if (pages < SIZE_MAX / PAGE_SIZE) - size_max = pages * PAGE_SIZE; - else - size_max = SIZE_MAX; - if (nodes_max <= 3) { if (pages < INT_MAX / nodes_per_page) nodes_max = pages * nodes_per_page; --YiEDa0DAkWCtVeE4--