Gentoo Archives: gentoo-user

From: Mark Knecht <markknecht@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Limit number of cores used by emerge?
Date: Fri, 30 Sep 2011 22:48:36
Message-Id: CAK2H+ecH9iD4c00biw0HjPMuxs0-xx2-dwMq-=Za4VcztZbGdw@mail.gmail.com
In Reply to: Re: [gentoo-user] Limit number of cores used by emerge? by Neil Bothwick
1 On Fri, Sep 30, 2011 at 3:09 PM, Neil Bothwick <neil@××××××××××.uk> wrote:
2 > On Fri, 30 Sep 2011 11:15:16 -0700, Mark Knecht wrote:
3 >
4 >> > If your MAKEOPTS is -j3 then it's not going to use more than 3 cores
5 >> > at a time but it will touch all 12 cores throughout the process
6 >> > because of the normal load balancing. If you want it to use only 3
7 >> > specific cores, you would need to set the processor affinity (usually
8 >> > done using the "taskset" command from sys-apps/util-linux).
9 >
10 >> My experience with -j3 is not that it limits emerge to 3 CPU cores but
11 >> rather it limits emerge to running 3 _jobs_. There's a big difference.
12 >> 1 job can use 12 cores if gcc spawns a lot of stuff in parallel, which
13 >> in my experience it does. It's this parallel spawn running up to 12
14 >> cores in use which causes the machine to lag. Even when not setting
15 >> the -j option at all which results in a single package being emerged
16 >> at one time, I often use 6-12 cores in use for short periods of time
17 >> as gcc builds that package.
18 >
19 > That's the --jobs option for emerge. The suggestion was to set the -J
20 > option in MAKEOPTS, which tells GCC how many compilation threads to run
21 > at once, and that's one core per thread. You'll also need to set -j 1 for
22 > emerge, which will also reduce the amount of disk thrashing that can
23 > happen when two package hit unpack at the same time.
24 >
25 >
26 > --
27 > Neil Bothwick
28
29 OK, my bad for confusing the two. Currently make.conf in the chroot says:
30
31 MAKEOPTS="-j3"
32
33 and when I run emerge in the chroot it's typically
34
35 emerge -DuN -j2 @world
36
37 so I think that's about right, or would hope it is anyway. If you see
38 a problem please let me know.
39
40 I'll add the ionice stuff this weekend and see how it goes.
41
42 Thanks,
43 Mark

Replies

Subject Author
Re: [gentoo-user] Limit number of cores used by emerge? Paul Hartman <paul.hartman+gentoo@×××××.com>