1 |
On 12/07/2020 09:04, William Kenworthy wrote: |
2 |
> Hi, |
3 |
> |
4 |
> is there a way to change the MAKEOPTS setting on a running emerge? |
5 |
> I am using "-j 5 -l 4" whilst emerging gcc-9.3 but its creating too much |
6 |
> pressure on memory. I expect the emerge to take many more hours but |
7 |
> complete eventually - but reducing it to "-j2" will help other |
8 |
> operations whilst not losing whats already been completed (this is an |
9 |
> old atom N330 with 4G ram and is my gateway/router/firewall/snort/... |
10 |
> and the overload is starting to affect the network throughput |
11 |
> significantly). |
12 |
|
13 |
No. But what you can do is lower its nice level to 19, and CPU and IO |
14 |
priority to "idle". First, find the process IDs of emerge and make: |
15 |
|
16 |
ps aux | grep emerge |
17 |
ps aux | grep make |
18 |
|
19 |
The first number after the user name (which is "root") is the pid. Then |
20 |
do the following for both pids: |
21 |
|
22 |
schedtool -D -n 19 pid |
23 |
ionice -c 3 -p pid |
24 |
|
25 |
ionice is in sys-apps/util-linux, so it's probably already installed. |
26 |
schedtool though is in sys-process/schedtool and it might not be |
27 |
installed. Nothing you can do about that right now. You have to wait it |
28 |
out. ionice should help a bit though. |
29 |
|
30 |
In the future, I *highly* recommend installing schedtool, and then put |
31 |
this in your make.conf: |
32 |
|
33 |
PORTAGE_NICENESS=19 |
34 |
PORTAGE_IONICE_COMMAND="sh -c \"schedtool -D \${PID}; ionice -c 3 -p |
35 |
\${PID}\"" |
36 |
|
37 |
I have used this for many years now. It makes emerge have a virtually |
38 |
imperceptible impact on my system. I can emerge for example gcc or |
39 |
libreoffice with -j4 on my 4 cores/4 threads CPU, and I feel no slowdown |
40 |
at all. This won't help with running out of RAM obviously, but it helps |
41 |
immensely with keeping the system highly responsive. |
42 |
|
43 |
Another thing I recommend is getting rid of "-j5". Use -j4. The "+1" |
44 |
recommendation from decades ago does not apply anymore with modern Linux |
45 |
kernels. You can test this yourself by emerging a smaller package that |
46 |
takes like 2 minutes or so to emerge, and compare times with j4 and j5. |
47 |
Most likely you will see no difference, other than j5 using more RAM. |