Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: Unexpected side effect of GCC 4
Date: Mon, 06 Nov 2006 16:12:50
Message-Id: einlmd$37e$2@sea.gmane.org
In Reply to: Re: [gentoo-amd64] Re: Unexpected side effect of GCC 4 by Peter Humphrey
1 Peter Humphrey <prh@××××××××××.uk> posted
2 200611061144.01773.prh@××××××××××.uk, excerpted below, on Mon, 06 Nov
3 2006 11:44:01 +0000:
4
5 > On Monday 06 November 2006 08:41, Duncan wrote:
6 >
7 >> Peter Humphrey <prh@××××××××××.uk> posted
8 >> > Perhaps I ought to look into putting /tmp and /var/tmp onto tmpfs.
9 >>
10 >> Do so. It makes a /big/ difference!
11 >
12 > My reading so far suggests that I include these two lines in /etc/fstab:
13 >
14 > tmpfs /tmp tmpfs nodev,nosuid,noexec 0 0
15 > tmpfs /var/tmp tmpfs nodev,nosuid,noexec 0 0
16 >
17 > Is that all I have to do? I assume I don't need to specify tmpfs sizes; I
18 > have 4 GB RAM of which 0.5 GB is unavailable (owing to a motherboard
19 > problem that prompted the system builder to refund some of my money -
20 > small consolation).
21
22 I believe I remember your posts talking about that, back when I still had
23 only a gig of RAM. Now that I have more than 3.5 gig of memory myself, I
24 know a bit more about the memory hole and all that. If you have bios
25 entries for configuring it and just couldn't get it to work before, maybe
26 now that I know a bit more about the issue, we could try to work thru it.
27 Of course, if you don't have the BIOS entries, it's just not going to
28 happen...
29
30 You don't /need/ to specify tmpfs size, but it might be worthwhile to do
31 so. You don't want a runaway file in /tmp to take up all your memory and
32 swap. Be aware that if you mount as tmpfs any location normally
33 having global write permissions (the usual 1777 of /tmp for instance), you
34 are letting any account have access to that memory. If you are the only
35 human user of the machine, that's probably fine, but if not, you may want
36 to ensure you are running quotas on it or something, and have them set
37 appropriately.
38
39 If you are just concerned about portage, you can of course point
40 $PORTAGE_TMPDIR at a location other than the default, and set that
41 location user portage group portage, 740 permissions or similar, so only
42 portage (and root of course) can write to it. It's still possible that
43 anyone in group portage could abuse it, but not simple users not in group
44 portage. then.
45
46 Here, as I'm the only human user, I don't have to be quite so strict on
47 security. To keep things simple, /var/tmp is a symlink to /tmp, so I don't
48 have to worry about a tmpfs for both dirs. You'll want to set the
49 following in make.conf:
50
51 PKG_TMPDIR
52 PORTAGE_TMPDIR
53 PORTAGE_TMPFS
54
55 Note that setting the latter to a small, say 50 meg, tmpfs, is useful
56 even if you aren't setting PORTAGE_TMPDIR on tmpfs. It's used for
57 quick/small stuff like lockfiles and the like. The portage docs suggest
58 setting it to /dev/shm, an LSB standard location for such things. I have
59 a separate (max 50 meg as I said) tmpfs mounted at /dev/shm and followed
60 the recommendation to point PORTAGE_TMPFS at it.
61
62 Of course, you'll only need PKG_TMPDIR if you have FEATURES=buildpkg set
63 or otherwise deal with binary packages.
64
65 I have /tmp (which is where both the package and portage TMPDIRs point) set
66 size=5g here, with 8 gig memory. With 3.5 gig of memory, you may wish to
67 set something a bit smaller, say 3 gig. That should be fine for most
68 emerges and will keep it from going too much into swap if something should
69 start hogging your tmpfs. Of course, you'll have to make it a bit bigger
70 for merging say OOo (not the bin-version), as it is said to require 5 gigs
71 of space (I don't use it so wouldn't personally know), but you could use
72 remount for special cases like that, keeping it to 3 gig or so normally.
73
74 > Probably I should put a script into /etc/conf.d/start.local to create a
75 > symlink from /var/tmp/ccache back to a real cache directory on disk, as
76 > it seems daft to install a compiler cache and then flush it at every
77 > reboot - at present mine has 1.5 GB of data. /tmp has 750 MB of stuff
78 > and is a separate disk partition at present, mounted on whichever system
79 > I boot.
80
81 Don't worry about that symlink. Set CCACHE_DIR in make.conf directly,
82 instead. Here, I have it pointed at a subdir on my fast raid-0/striped
83 array. That works quite well. Since all the stuff portage normally uses
84 (gcc, grep, sed, libraries commonly linked, etc) read into the regular
85 kernel filesystem cache memory during the first emerge, and with all the
86 work being done on tmpfs, there's little i/o but the ccache write updates
87 going on during all but the qmerge phase of subsequent emerges. The disk
88 spends most of its time idle, and you can watch the disk activity light
89 and tell when the kernel's cache flush writes kick in, as it blinks red a
90 couple times every few seconds. That's it.
91
92 --
93 Duncan - List replies preferred. No HTML msgs.
94 "Every nonfree program has a lord, a master --
95 and if you use the program, he is your master." Richard Stallman
96
97 --
98 gentoo-amd64@g.o mailing list

Replies

Subject Author
Re: [gentoo-amd64] Re: Unexpected side effect of GCC 4 Peter Humphrey <prh@××××××××××.uk>