Re: [gentoo-user] Limit number of cores used by emerge?

2011-10-01 Thread Mark Knecht
On Fri, Sep 30, 2011 at 4:05 PM, Paul Hartman
paul.hartman+gen...@gmail.com wrote:
 On Fri, Sep 30, 2011 at 5:47 PM, Mark Knecht markkne...@gmail.com wrote:
 OK, my bad for confusing the two. Currently make.conf in the chroot says:

 MAKEOPTS=-j3

 and when I run emerge in the chroot it's typically

 emerge -DuN -j2 @world

 so I think that's about right, or would hope it is anyway. If you see
 a problem please let me know.

 The -j2 on emerge means it'll run 2 makes at once, and each make is
 getting -j3, so it'll use (up to) 6 cores at once. You probably want
 to just stop using -j option for emerge entirely and stick to the
 MAKEOPTS one.



I wondered about that. Thanks. It's back to single packages at a time
in the chroot.

Cheers,
Mark



[gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Mark Knecht
Hi,
   Is there a portage option that will limit the number of cores used
by emerge? For instance, in a chroot on a 12 core machine I want to
limit emerge to not using more than 3 cores?

   If possible, I'd also like to limit the total disk bandwidth
consumption during emerge. For instance, when untarring a big file to
do the emerge at times the disk consumption gets to high and the
machine becomes laggy. Is there an option that addresses this?

   These questions are mostly about being able to update a chroot
mid-day without other tasks slowing down too much. I don't care how
long the chroot really takes to get a huge emerge done, but rathe just
keeping the machine very responsive while it's happening. I already
use:

MAKEOPTS=-j3
PORTAGE_NICENESS=15

which helps (I think) but it doesn't totally address either of the issues above.

Thanks,
Mark



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Dale

Mark Knecht wrote:

Hi,
Is there a portage option that will limit the number of cores used
by emerge? For instance, in a chroot on a 12 core machine I want to
limit emerge to not using more than 3 cores?

If possible, I'd also like to limit the total disk bandwidth
consumption during emerge. For instance, when untarring a big file to
do the emerge at times the disk consumption gets to high and the
machine becomes laggy. Is there an option that addresses this?

These questions are mostly about being able to update a chroot
mid-day without other tasks slowing down too much. I don't care how
long the chroot really takes to get a huge emerge done, but rathe just
keeping the machine very responsive while it's happening. I already
use:

MAKEOPTS=-j3
PORTAGE_NICENESS=15

which helps (I think) but it doesn't totally address either of the issues above.

Thanks,
Mark




This may help:

PORTAGE_IONICE_COMMAND=ionice -c -3 -p \${PID}

Make sure you have util-linux installed since it has the ionice 
command.  I think you have to have it enabled in the kernel as well.  
I'm not certain tho.


On my machine, even if I tell emerge to only do one job at a time, it 
still staggers around the cores.  I guess it makes the CPU heat spread 
out evenly or something.


Hope that helps.

Dale

:-)  :-)



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Michael Mol
On Fri, Sep 30, 2011 at 12:55 PM, Dale rdalek1...@gmail.com wrote:
 Mark Knecht wrote:
    Is there a portage option that will limit the number of cores used
 by emerge? For instance, in a chroot on a 12 core machine I want to
 limit emerge to not using more than 3 cores?
 On my machine, even if I tell emerge to only do one job at a time, it still
 staggers around the cores.  I guess it makes the CPU heat spread out evenly
 or something.

Difference between number of cores and which cores...-j1 should
mean it won't use more than one core at a time, but it might switch
around which core when the process gets descheduled and brought back.
(Or when a process ends and another is spawned)

-- 
:wq



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Dale

Michael Mol wrote:

On Fri, Sep 30, 2011 at 12:55 PM, Dalerdalek1...@gmail.com  wrote:

Mark Knecht wrote:

Is there a portage option that will limit the number of cores used
by emerge? For instance, in a chroot on a 12 core machine I want to
limit emerge to not using more than 3 cores?

On my machine, even if I tell emerge to only do one job at a time, it still
staggers around the cores.  I guess it makes the CPU heat spread out evenly
or something.

Difference between number of cores and which cores...-j1 should
mean it won't use more than one core at a time, but it might switch
around which core when the process gets descheduled and brought back.
(Or when a process ends and another is spawned)




I'm not certain of why but when I am doing anything CPU intensive, it 
bounces from one core to another every 15 or 20 seconds.  I just assume 
it is a heat thing.  I created a 6Gb tarball the other day that took 
quite a while.  It looks like a bar graph equalizer with the processes 
bouncing around from core to core.  I just thought it worth mentioning 
in case the OP didn't realize this.  Heck, I have had this happen with 
Seamonkey and I don't think it even sees multiple cores or anything.


I also forgot to mention that the IONICE line goes in make.conf if you 
want it to be used each time.


Dale

:-)  :-)



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Paul Hartman
On Fri, Sep 30, 2011 at 11:25 AM, Mark Knecht markkne...@gmail.com wrote:
 Hi,
   Is there a portage option that will limit the number of cores used
 by emerge? For instance, in a chroot on a 12 core machine I want to
 limit emerge to not using more than 3 cores?

   If possible, I'd also like to limit the total disk bandwidth
 consumption during emerge. For instance, when untarring a big file to
 do the emerge at times the disk consumption gets to high and the
 machine becomes laggy. Is there an option that addresses this?

   These questions are mostly about being able to update a chroot
 mid-day without other tasks slowing down too much. I don't care how
 long the chroot really takes to get a huge emerge done, but rathe just
 keeping the machine very responsive while it's happening. I already
 use:

 MAKEOPTS=-j3
 PORTAGE_NICENESS=15

 which helps (I think) but it doesn't totally address either of the issues 
 above.

If your MAKEOPTS is -j3 then it's not going to use more than 3 cores
at a time but it will touch all 12 cores throughout the process
because of the normal load balancing. If you want it to use only 3
specific cores, you would need to set the processor affinity (usually
done using the taskset command from sys-apps/util-linux).

For the disk I/O you can set an ionice in your make.conf like:
PORTAGE_IONICE_COMMAND=ionice -c 3 -p \${PID}

Salt to taste. :)



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Mark Knecht
On Fri, Sep 30, 2011 at 10:28 AM, Paul Hartman
paul.hartman+gen...@gmail.com wrote:
 On Fri, Sep 30, 2011 at 11:25 AM, Mark Knecht markkne...@gmail.com wrote:
 Hi,
   Is there a portage option that will limit the number of cores used
 by emerge? For instance, in a chroot on a 12 core machine I want to
 limit emerge to not using more than 3 cores?

   If possible, I'd also like to limit the total disk bandwidth
 consumption during emerge. For instance, when untarring a big file to
 do the emerge at times the disk consumption gets to high and the
 machine becomes laggy. Is there an option that addresses this?

   These questions are mostly about being able to update a chroot
 mid-day without other tasks slowing down too much. I don't care how
 long the chroot really takes to get a huge emerge done, but rathe just
 keeping the machine very responsive while it's happening. I already
 use:

 MAKEOPTS=-j3
 PORTAGE_NICENESS=15

 which helps (I think) but it doesn't totally address either of the issues 
 above.

 If your MAKEOPTS is -j3 then it's not going to use more than 3 cores
 at a time but it will touch all 12 cores throughout the process
 because of the normal load balancing. If you want it to use only 3
 specific cores, you would need to set the processor affinity (usually
 done using the taskset command from sys-apps/util-linux).

 For the disk I/O you can set an ionice in your make.conf like:
 PORTAGE_IONICE_COMMAND=ionice -c 3 -p \${PID}

 Salt to taste. :)


Thanks to all who have answered so far. I'll give the ionice command a
try immediately. I'll try to address my view of other comments in a
single post to keep the traffic down.

My experience with -j3 is not that it limits emerge to 3 CPU cores but
rather it limits emerge to running 3 _jobs_. There's a big difference.
1 job can use 12 cores if gcc spawns a lot of stuff in parallel, which
in my experience it does. It's this parallel spawn running up to 12
cores in use which causes the machine to lag. Even when not setting
the -j option at all which results in a single package being emerged
at one time, I often use 6-12 cores in use for short periods of time
as gcc builds that package. This is completely appropriate for the
host machine. When I do updates I want them to get done ASAP. On the
other hand, for a chroot it's too much power.

Concerning which core is used, I don't care.

Concerning the 'bouncing around' aspect of multi-core processors,
that's primarily a CPU function of where it has cached data  code as
well as thermal management on chip. Internal hardware is generally
controlling what CPU gets used for what as far as I know. However even
a single emerge job (1 package being emerged) could move around from
core to core depending on what work is getting done. It's
understandable that a driver might be fundamentally associated with a
specific core's immediate L1 or L2 cache, whereas the emerge job
itself could be using other cores.

Of course, everything above is just my limited understanding of what
the hardware is doing and could be completely wrong.

Thanks,
Mark



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Dale

Paul Hartman wrote:

On Fri, Sep 30, 2011 at 11:25 AM, Mark Knechtmarkkne...@gmail.com  wrote:

Hi,
   Is there a portage option that will limit the number of cores used
by emerge? For instance, in a chroot on a 12 core machine I want to
limit emerge to not using more than 3 cores?

   If possible, I'd also like to limit the total disk bandwidth
consumption during emerge. For instance, when untarring a big file to
do the emerge at times the disk consumption gets to high and the
machine becomes laggy. Is there an option that addresses this?

   These questions are mostly about being able to update a chroot
mid-day without other tasks slowing down too much. I don't care how
long the chroot really takes to get a huge emerge done, but rathe just
keeping the machine very responsive while it's happening. I already
use:

MAKEOPTS=-j3
PORTAGE_NICENESS=15

which helps (I think) but it doesn't totally address either of the issues above.

If your MAKEOPTS is -j3 then it's not going to use more than 3 cores
at a time but it will touch all 12 cores throughout the process
because of the normal load balancing. If you want it to use only 3
specific cores, you would need to set the processor affinity (usually
done using the taskset command from sys-apps/util-linux).

For the disk I/O you can set an ionice in your make.conf like:
PORTAGE_IONICE_COMMAND=ionice -c 3 -p \${PID}

Salt to taste. :)




Well, this is interesting:

root@fireball # emerge -1av kate
ionice: bad prio class -3
 * PORTAGE_IONICE_COMMAND returned 1
 * See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage 
instructions.


When I went to copy this, I noticed it was commented out.  Now I see 
why.  What's up with this?


I bet Mark is going to get this too.

Dale

:-)  :-)



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Paul Hartman
On Fri, Sep 30, 2011 at 1:41 PM, Dale rdalek1...@gmail.com wrote:
 Well, this is interesting:

 root@fireball # emerge -1av kate
 ionice: bad prio class -3
  * PORTAGE_IONICE_COMMAND returned 1
  * See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage
 instructions.

 When I went to copy this, I noticed it was commented out.  Now I see why.
  What's up with this?

 I bet Mark is going to get this too.

I bet you have a typo on your ionice command in make.conf. :)

You should have -c 3 not -c -3 as I will guess you might have from
that error message about priority class -3.



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Dale

Paul Hartman wrote:

On Fri, Sep 30, 2011 at 1:41 PM, Dalerdalek1...@gmail.com  wrote:

Well, this is interesting:

root@fireball # emerge -1av kate
ionice: bad prio class -3
  * PORTAGE_IONICE_COMMAND returned 1
  * See the make.conf(5) man page for PORTAGE_IONICE_COMMAND usage
instructions.

When I went to copy this, I noticed it was commented out.  Now I see why.
  What's up with this?

I bet Mark is going to get this too.

I bet you have a typo on your ionice command in make.conf. :)

You should have -c 3 not -c -3 as I will guess you might have from
that error message about priority class -3.




BINGO !!  That was it.  Mark, if you copy mine, remove the - in front of 
the 3.  Aw heck,


PORTAGE_IONICE_COMMAND=ionice -c 3 -p \${PID}

That one works mucho better.  ;-)

Thanks Paul for seeing my boo boo.  Thing is, I copied and pasted that 
from somewhere.


Dale

:-)  :-)



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Neil Bothwick
On Fri, 30 Sep 2011 11:15:16 -0700, Mark Knecht wrote:

  If your MAKEOPTS is -j3 then it's not going to use more than 3 cores
  at a time but it will touch all 12 cores throughout the process
  because of the normal load balancing. If you want it to use only 3
  specific cores, you would need to set the processor affinity (usually
  done using the taskset command from sys-apps/util-linux).

 My experience with -j3 is not that it limits emerge to 3 CPU cores but
 rather it limits emerge to running 3 _jobs_. There's a big difference.
 1 job can use 12 cores if gcc spawns a lot of stuff in parallel, which
 in my experience it does. It's this parallel spawn running up to 12
 cores in use which causes the machine to lag. Even when not setting
 the -j option at all which results in a single package being emerged
 at one time, I often use 6-12 cores in use for short periods of time
 as gcc builds that package.

That's the --jobs option for emerge. The suggestion was to set the -J
option in MAKEOPTS, which tells GCC how many compilation threads to run
at once, and that's one core per thread. You'll also need to set -j 1 for
emerge, which will also reduce the amount of disk thrashing that can
happen when two package hit unpack at the same time.


-- 
Neil Bothwick

If at first you don't succeed, skydiving is not for you.


signature.asc
Description: PGP signature


Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Mark Knecht
On Fri, Sep 30, 2011 at 3:09 PM, Neil Bothwick n...@digimed.co.uk wrote:
 On Fri, 30 Sep 2011 11:15:16 -0700, Mark Knecht wrote:

  If your MAKEOPTS is -j3 then it's not going to use more than 3 cores
  at a time but it will touch all 12 cores throughout the process
  because of the normal load balancing. If you want it to use only 3
  specific cores, you would need to set the processor affinity (usually
  done using the taskset command from sys-apps/util-linux).

 My experience with -j3 is not that it limits emerge to 3 CPU cores but
 rather it limits emerge to running 3 _jobs_. There's a big difference.
 1 job can use 12 cores if gcc spawns a lot of stuff in parallel, which
 in my experience it does. It's this parallel spawn running up to 12
 cores in use which causes the machine to lag. Even when not setting
 the -j option at all which results in a single package being emerged
 at one time, I often use 6-12 cores in use for short periods of time
 as gcc builds that package.

 That's the --jobs option for emerge. The suggestion was to set the -J
 option in MAKEOPTS, which tells GCC how many compilation threads to run
 at once, and that's one core per thread. You'll also need to set -j 1 for
 emerge, which will also reduce the amount of disk thrashing that can
 happen when two package hit unpack at the same time.


 --
 Neil Bothwick

OK, my bad for confusing the two. Currently make.conf in the chroot says:

MAKEOPTS=-j3

and when I run emerge in the chroot it's typically

emerge -DuN -j2 @world

so I think that's about right, or would hope it is anyway. If you see
a problem please let me know.

I'll add the ionice stuff this weekend and see how it goes.

Thanks,
Mark



Re: [gentoo-user] Limit number of cores used by emerge?

2011-09-30 Thread Paul Hartman
On Fri, Sep 30, 2011 at 5:47 PM, Mark Knecht markkne...@gmail.com wrote:
 OK, my bad for confusing the two. Currently make.conf in the chroot says:

 MAKEOPTS=-j3

 and when I run emerge in the chroot it's typically

 emerge -DuN -j2 @world

 so I think that's about right, or would hope it is anyway. If you see
 a problem please let me know.

The -j2 on emerge means it'll run 2 makes at once, and each make is
getting -j3, so it'll use (up to) 6 cores at once. You probably want
to just stop using -j option for emerge entirely and stick to the
MAKEOPTS one.