Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo MAKEOPTS question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
andrewwalker27
l33t
l33t


Joined: 27 Jun 2005
Posts: 660

PostPosted: Sun Jun 14, 2020 10:44 pm    Post subject: Gentoo MAKEOPTS question Reply with quote

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
View user's profile Send private message
alamahant
Guru
Guru


Joined: 23 Mar 2019
Posts: 358

PostPosted: Sun Jun 14, 2020 10:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 474
Location: /home

PostPosted: Mon Jun 15, 2020 5:13 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
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