Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Limit Portage CPU % without configuring niceness?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
pankung
n00b
n00b


Joined: 12 Oct 2013
Posts: 5

PostPosted: Thu Oct 17, 2013 7:43 am    Post subject: Limit Portage CPU % without configuring niceness? Reply with quote

Hi

I really have to limit Portage's CPU usage (e.g. it's currently max 100% but I need 50%) because my PC's fan is acting weird (INSANELY loud when max cpu) and it's really annoying. :(

I tried searching on the net for DAYS and nothing helped me. Can't find a solution either.
Is there a way to do so without (all of this doesn't work) :
Code:

PORTAGE_NICENESS
nice
that harddisk io thing
pwmconfig
lm_sensors
sensors-detect
replacing the fan (no money :p )
plugging my ears (duh)
reduce MAKEOPTS (My PC is a Core 2 Quad)

?

So, the thing I want is when Portage is running (emerge blahblahblah) I want the max CPU freq usage to be 50% (Including every compilers eg. gcc gcc++ python etc etc)

Pls help.

Thanks

(Sorry if my English is not very good, I'm a little dizzy right now after trying to make a gentooish KDE)
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4060
Location: USA

PostPosted: Thu Oct 17, 2013 3:17 pm    Post subject: Reply with quote

I wouldn't call the fan going extremely loud when the CPU is hot, that's perfectly normal. Fans do make more noise when spinning faster. Especially laptop fans. Really the only solution is replacing the fan if it's inadequate, or live with it.

Are you already limiting to single core, meaning don't use more than 1 core? The more cores active, the hotter it gets.

Really, the limit is not in portage, but rather you may have to configure the CPU to underclock or adjust the throttling in the kernel frequency control. Compiling was meant to go full bore on all remaining CPU cycles...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
pankung
n00b
n00b


Joined: 12 Oct 2013
Posts: 5

PostPosted: Thu Oct 17, 2013 3:27 pm    Post subject: Reply with quote

eccerr0r wrote:
I wouldn't call the fan going extremely loud when the CPU is hot, that's perfectly normal. Fans do make more noise when spinning faster. Especially laptop fans. Really the only solution is replacing the fan if it's inadequate, or live with it.

Are you already limiting to single core, meaning don't use more than 1 core? The more cores active, the hotter it gets.

Really, the limit is not in portage, but rather you may have to configure the CPU to underclock or adjust the throttling in the kernel frequency control. Compiling was meant to go full bore on all remaining CPU cycles...


Hi

Thanks for the reply :)

Here's the situation: One day, when the CPU is 100%, the fan is about, let's say, 50dB. The next day, somehow, CPU 100%, it went up to 80dB++ :p and forever.
I'm using all the cores (MAKEOPTS="-j5") but when I tried MAKEOPTS="-j3", well, all the CPUS are still 100%. Weird. (The -j3 every CPU 100 situation is on laptop, can't test PC yet, udev broken can't boot :( )

I've make menuconfig'd the kernel and saw the x86 driver thing in ACPI, which, from my information, will make cpufreqd work hopefully, but I don't know what to choose!

So I chose all of them. It didn't work.

And the fan thing, I checked the BIOS and well, everything is normal (fan controller on, fan check thingy on) except when the CPU is 40C, the fan is about 4000rpm, which is weird, considering that one week ago it hangs around 2000rpm. I know this is a HW issue, so I need to limit the cpu.

HELP PLS! ;(

(Sorry I'm quite old on Linux but a complete n00b on Gentoo)
Back to top
View user's profile Send private message
nlsa8z6zoz7lyih3ap
Guru
Guru


Joined: 25 Sep 2007
Posts: 332
Location: Canada

PostPosted: Thu Oct 17, 2013 3:42 pm    Post subject: Reply with quote

I have the following in /etc/make.conf
Code:
EMERGE_DEFAULT_OPTS="--jobs=8  --load-average=16  --keep-going=y  --with-bdeps=y --complete-graph"


You could try the following:

Code:
EMERGE_DEFAULT_OPTS="--jobs=1  --load-average=1  --keep-going=y  --with-bdeps=y --complete-graph"

or something like it. The items relevant to your issue would be covered with
Code:
EMERGE_DEFAULT_OPTS="--jobs=1  --load-average=1
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1242
Location: 42.68n 85.41w

PostPosted: Thu Oct 17, 2013 4:07 pm    Post subject: Reply with quote

get duster, dust the heat sink, get a cookie rack. pypy? pypy is much quicker at python than python is. so that 100% if its still 100% under pypy its only a fraction of the time.

duster and cookie rack made my laptop much quieter, before it would overheat and shutdown building gentoo.
_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
https://wiki.gentoo.org/index.php?title=Special:Contributions/666threesixes666&offset=&limit=500&target=666threesixes666
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4060
Location: USA

PostPosted: Thu Oct 17, 2013 4:56 pm    Post subject: Reply with quote

Keep in mind that running two cores at 50% generates as much waste heat (or possibly more*) than one at 100%. There may be more centralized heating, but this is the job of the heat spreader and heat sink to deal with.

* more, if the CPU is capable of shutting off cores completely and running one core at 100%.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
destroyedlolo
Guru
Guru


Joined: 17 Jun 2011
Posts: 476
Location: Close to Annecy (France)

PostPosted: Thu Oct 17, 2013 7:48 pm    Post subject: Reply with quote

Another option should be to keep the CPU frequency to the lowest one ...
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4060
Location: USA

PostPosted: Fri Oct 18, 2013 12:05 am    Post subject: Reply with quote

Yes, the only solution here is to reduce clock speed/underclock and undervolt, that's really the only way to reduce heat production. Using fewer cores helps.

Both of these will simply make it take longer to finish.

I'd say plugging ears is best solution unless the fan is about to break. If it's totally air noise (versus bearing noise) I'd say that there's nothing wrong with it making that much noise, as long as it's still cooling fine. Make sure it's not really overheating (possibly your heat sink compound is no good, or the heatsink is assembled wrong) by using coretemp kernel module with lm-sensors.

I have a Core2Quad 9550S, Core2Quad 6600, and a Core i7 2700K (all are DESKTOP), these all will speed up their fans (all stock Intel fans) when under load but they aren't noisy at all... The stock fans that come with the CPUs are pretty good I think. In a laptop, you're asking for trouble with quad core CPUs...
Back to top
View user's profile Send private message
pankung
n00b
n00b


Joined: 12 Oct 2013
Posts: 5

PostPosted: Fri Oct 18, 2013 2:51 am    Post subject: Reply with quote

(This is a reply to everyone)

I'm fine with slower compilation :p. Okay, so the situation now is:

coretemp isn't working (i think)
my mobo doesn't support pwm (not sure either. Any way to check?)
x86 acpi driver isn't working at all

So I think I will try cleaning the heat sink, and EMERGE_DEFAULT_OPTS

BTW nlsa8z6zoz7lyih3ap is it /etc/make.conf or /etc/portage/make.conf? I'm not sure on this one. Saw a lot of /etc/make.conf on the net though.

BTW eccerr0r my laptop is a i5-3210m which is dual core but with hyperthreading on. Does that make portage act a bit ~ when it comes to cpu management?

My PC is probably 5 yrs old now. Time for a new one, if all solutions doesn't work. :oops:

(Please don't feel offend if I haven't replied to your post, it's just that this post will be too jumbled up. I've read all your replies.)
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2454
Location: Silver City, NM

PostPosted: Fri Oct 18, 2013 4:55 am    Post subject: Reply with quote

pankung wrote:
Here's the situation: One day, when the CPU is 100%, the fan is about, let's say, 50dB. The next day, somehow, CPU 100%, it went up to 80dB++ :p and forever.

This means you need to get a new fan. Get a new fan!
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4060
Location: USA

PostPosted: Fri Oct 18, 2013 6:30 am    Post subject: Reply with quote

Odd, thought you mentioned it was a core2quad. But nevertheless it's still the same problem, except a bit bigger because 1 thread is half the processor, instead of a quarter...

Now that you mention that you have an laptop i5 like my i5-3317U laptop (dual core dual thread, and yes this thing gets viciously loud when both cores plus the GPU is stressed), they have a feature called turbo-boost that increases clock speed.when it notices it can without going over power. This will bump up heat consumption forcing the fan to turn on.

I don't know why coretemp isn't working, it should work as is (make sure you have lm-sensors). This will tell you how hot the CPU really is, and whether or not you need to take action.

You should be able to compile in the ACPI P-states CPUFREQ driver into the kernel, and you should set it to "powersave" - this will reduce power consumption and thus reduce temperatures.

And to reiterate, make sure your fan is clean from dust, and heat sink is properly attached to the CPU. Yes it's a laptop, but it still has a heatsink...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9013
Location: beyond the rim

PostPosted: Tue Oct 29, 2013 2:48 pm    Post subject: Reply with quote

There is no way to limit any program to 50% (or any %age) cpu usage, as such percentages are totally artificial numbers. They only exist in monitoring tools like top and don't actually tell you how loaded the actual CPU is, only how often a program was in the "running" state compared to others in a specific time interval.
Back to top
View user's profile Send private message
eccerr0r
Advocate
Advocate


Joined: 01 Jul 2004
Posts: 4060
Location: USA

PostPosted: Tue Oct 29, 2013 5:18 pm    Post subject: Reply with quote

What would be funny is if it were possible to make the "idle" task into a real task... and make it have as high priority as any other application... :)

I think just setting a dual core dual thread CPU to a maximum of 1 job, load average of 1 - on average uses 50% of the total CPU power. It will probably use one core at 100% due to process affinity, but the other core will be at 0% - the average is 50%. If one really needs to use both cores at 50% perhaps it's possible to hack the kernel to randomly pick a core to schedule one task on... This will be slower than running all on one core and leaving the other idle, as it would force cache/TLB flushes each time it decides to swap cores.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed to be advocating?
Back to top
View user's profile Send private message
schorsch_76
Apprentice
Apprentice


Joined: 19 Jun 2012
Posts: 215

PostPosted: Tue Oct 29, 2013 5:31 pm    Post subject: Reply with quote

You could put that process in a cgroup and limit its access to resources (like cpu time). as an example i attached [2] which shows the same thing on xbmc.

[1] http://wiki.gentoo.org/wiki/OpenRC/CGroups
[2] http://stijn.tintel.eu/blog/2010/11/20/optimizing-xbmc-performance-cgroups
[3] http://en.wikipedia.org/wiki/Cgroup
[4] https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things 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