public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Michael <confabulate@kintzios.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Re: Change MAKEOPTS on the fly?
Date: Sun, 12 Jul 2020 09:59:35 +0100	[thread overview]
Message-ID: <3312794.iIbC2pHGDl@lenovo.localdomain> (raw)
In-Reply-To: <reehkk$kl6$1@ciao.gmane.io>

[-- Attachment #1: Type: text/plain, Size: 2758 bytes --]

On Sunday, 12 July 2020 09:29:08 BST Nikos Chantziaras wrote:
> On 12/07/2020 09:04, William Kenworthy wrote:
> > Hi,
> > 
> >      is there a way to change the MAKEOPTS setting on a running emerge?
> > 
> > I am using "-j 5 -l 4" whilst emerging gcc-9.3 but its creating too much
> > pressure  on memory.  I expect the emerge to take many more hours but
> > complete eventually - but reducing it to "-j2" will help other
> > operations whilst not losing whats already been completed (this is an
> > old atom N330 with 4G ram and is my gateway/router/firewall/snort/...
> > and the overload is starting to affect the network throughput
> > significantly).
> 
> No. But what you can do is lower its nice level to 19, and CPU and IO
> priority to "idle". First, find the process IDs of emerge and make:
> 
>    ps aux | grep emerge
>    ps aux | grep make
> 
> The first number after the user name (which is "root") is the pid. Then
> do the following for both pids:
> 
>    schedtool -D -n 19 pid
>    ionice -c 3 -p pid
> 
> ionice is in sys-apps/util-linux, so it's probably already installed.
> schedtool though is in sys-process/schedtool and it might not be
> installed. Nothing you can do about that right now. You have to wait it
> out. ionice should help a bit though.
> 
> In the future, I *highly* recommend installing schedtool, and then put
> this in your make.conf:
> 
>    PORTAGE_NICENESS=19
>    PORTAGE_IONICE_COMMAND="sh -c \"schedtool -D \${PID}; ionice -c 3 -p
> \${PID}\""
> 
> I have used this for many years now. It makes emerge have a virtually
> imperceptible impact on my system. I can emerge for example gcc or
> libreoffice with -j4 on my 4 cores/4 threads CPU, and I feel no slowdown
> at all. This won't help with running out of RAM obviously, but it helps
> immensely with keeping the system highly responsive.

Another trick to use if the atom is becoming I/O disk bound is:

echo bfq > /sys/block/sda/queue/scheduler

This will have more of an impact if the PC is swapping heavily and the I/O on 
/dev/sda is choking other processes accessing the disk.


> Another thing I recommend is getting rid of "-j5". Use -j4. The "+1"
> recommendation from decades ago does not apply anymore with modern Linux
> kernels. You can test this yourself by emerging a smaller package that
> takes like 2 minutes or so to emerge, and compare times with j4 and j5.
> Most likely you will see no difference, other than j5 using more RAM.

On an older PC with 16G RAM I have noticed the +1 giving marginally faster 
results each time.  I tried repeated compiles of ffmpeg and n+1 or 2(n+1) was 
faster, as long as RAM was not exhausted.  On larger packages/less RAM, 
limiting MAKEOPTS individually would be advisable to avoid William's problem.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2020-07-12  8:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-12  6:04 [gentoo-user] Change MAKEOPTS on the fly? William Kenworthy
2020-07-12  8:29 ` [gentoo-user] " Nikos Chantziaras
2020-07-12  8:54   ` tastytea
2020-07-12  9:58     ` Nikos Chantziaras
2020-07-12  8:59   ` Michael [this message]
2020-07-12 10:03     ` Nikos Chantziaras
2020-07-12 11:38       ` William Kenworthy
2020-07-12 12:39         ` Michael
2020-07-13 16:10   ` Matt Connell (Gmail)
2020-07-13 16:33     ` Neil Bothwick
2020-07-13 16:50       ` Matt Connell (Gmail)
2020-07-13 17:43         ` Neil Bothwick
2020-07-13 23:34       ` Sam Jorna (wraeth)
2020-07-13 23:56         ` Sam Jorna (wraeth)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3312794.iIbC2pHGDl@lenovo.localdomain \
    --to=confabulate@kintzios.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox