View previous topic :: View next topic |
Author |
Message |
andrewwalker27 l33t


Joined: 27 Jun 2005 Posts: 660
|
Posted: Sun Jun 14, 2020 10:44 pm Post subject: Gentoo MAKEOPTS question |
|
|
I'm doing a fresh install on my new machine which has 16Gb of RAM and an AMD Ryzen 7 3700X and I'm unable to decide what value to use. The docs infer that MAKEOPTS="-j9" is the correct number but previous experience makes me cautious.
I previously had a 6 core machine which had -j7 set and the machine kept locking up every time I tried compiling firefox, I think it was a lack of memory issue and took me ages to diagnose and I don't want to make the same error. I'd assumed, incorrectly, the swap disk would solve memory shortage but I was wrong, is there any way of limiting ram usage?
Ideally I'd like to prevent gcc from using all the ram available without hitting the compile time too badly, I could reduce the -j value but that would probably do precisely that.
Anybody got any suggestions? |
|
Back to top |
|
 |
alamahant l33t

Joined: 23 Mar 2019 Posts: 673
|
Posted: Sun Jun 14, 2020 10:56 pm Post subject: |
|
|
Hi
The literature is that each job should be assigned 1.5-2 Gigs of ram.
I prefer -j4 so I can leisurely use my system while updating or emerging.
maybe you can use portage on tmpfs.
In /etc/fstab add a line
Code: |
tmpfs /var/tmp/portage tmpfs size=10G,uid=portage,gid=portage,mode=775,noatime
|
And in make.conf
Code: |
PORTAGE_TMPDIR=/var/tmp/portage
|
followed by a
Code: |
touch /var/tmp/portage
chown portage. /var/tmp/portage
|
This way you assign the desired memory to your tmpfs and you have lighting-speed compile times.
Another think that comes to mind is maybe cgroups.
But I dont know much about how to achieve this specifically. |
|
Back to top |
|
 |
Juippisi Developer


Joined: 30 Sep 2005 Posts: 510 Location: /home
|
Posted: Mon Jun 15, 2020 5:13 am Post subject: |
|
|
You can use package.env to reduce MAKEOPTS for specific packages,
https://wiki.gentoo.org/wiki//etc/portage/package.env
If you use tmpfs you might indeed hit memory problems when compiling bigger packages, since they take multiple gigabytes to store the temporary files in memory, then compiling eats its own share. 16 GB is too little for the big ones, but should be just fine for that 90 %. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|