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
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the 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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
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: 388
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: 1248
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.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the 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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
destroyedlolo
l33t
l33t


Joined: 17 Jun 2011
Posts: 846
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
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the 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: 2506
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
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the 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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9501
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
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9601
Location: almost Mile High in the 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/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
schorsch_76
Guru
Guru


Joined: 19 Jun 2012
Posts: 450

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
k9dog
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2009
Posts: 103
Location: Denmark

PostPosted: Tue Nov 27, 2018 8:39 am    Post subject: Reply with quote

Solutions to noise:

1) Remove dust
Dust your heat sinks. Possibly clean them totally.

2) Replace old fan
Fans of higher quality might lower noise
Bigger fans move more air at a lower db

3) Change cooling technology
Water cooling
Heat sinks with bigger fans can keep heat away from cpu/gpu/ram etc. You still need good air flow in your case
Computer case design. Some cases allow for heat to escape faster

4) Keep computer cool.
Open window and keep computer close. Keep away from direct sun.
Air condition might help. Remember air flow.

5) Remote
Strong computer in isolated rooms. Do a remote connect from a smaller computer With less software you need to upgrade.

6) Update time
Update at hours where temprature is low

Just some suggestions. Now for the cookies. Drink something cool and keep cookies away from your clean heat sink.
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 434
Location: Stockholm

PostPosted: Tue Nov 27, 2018 1:00 pm    Post subject: Reply with quote

I keep indoor temperatur at about 17 C, fans are normally silent... :)
Back to top
View user's profile Send private message
k9dog
Tux's lil' helper
Tux's lil' helper


Joined: 22 Jun 2009
Posts: 103
Location: Denmark

PostPosted: Wed Nov 28, 2018 8:59 am    Post subject: Reply with quote

Well guess your setup is nice. Your computer might be a powehog or you might have set it to start throttling up early (which is good as long as fans are silent and have a chance to rest - as in doesn't keep blowing for a very long time).
Your room temperature is VERY nice for the computer at least and I wouldn't worry about that part in your case, mostly mentioned it if it was summer Texas hot (never been there but you get the meaning).
It might be interesting what happens to temperature in your computer and how fast it escapes (if it keeps running for a long time after fairly long compilations).
If case fan throttle down soon after, both your CPU and case are pretty optimal in getting rid of heat. You can probably limit fan speeds a bit (both for CPU and case), but be careful not to overdo that (might need to check lm_sensor software), but it is a way to limit noise. You can also add some other temperature measurement if BIOS/CPU doesn't support it, just keep an eye on temprature after changes. You also need to keep CPU/GPU cool :). Intel CPUs (Most non x86/amd can easily be cooled even by passive means (noise free), x86/amd have lm_sensor abilities). You can usually do what you need with laptop_mode (lm_sensor USE flag I think should be set).
If you got sensitive ears, consider the water cooling (I personally don't like the thought of water and electricity). Limit small fans (they love to use them on small devices and near hard disks)
I strongly recommend taking a chance to open case after guarantee has expired as long as you got a fitting screwdriver. Clean out fluff on heat sinks (usually these sinks are apparent as they try to to increase area where heat can escape so they tipple or even fan out and mostly have an electric fan mounted), but don't take blowing as a bad sign, it is mostly if you begin getting deep sounds which can be from shaking. In many cases primary noise these days are graphics cards during games. Lowering noise could be as simple as ensuring that the card is mounted to the case in a way where it doesn't vibrate. Since you said it was mostly during updates, it is the CPU.
In some cases you can also limit the emplaning noise from fans by using certain plastic rings designed for it on case fans (at least).

Hope this ranting helps a bit :D
Back to top
View user's profile Send private message
Muso
Veteran
Veteran


Joined: 22 Oct 2002
Posts: 1052
Location: The Holy city of Honolulu

PostPosted: Wed Nov 28, 2018 1:45 pm    Post subject: Reply with quote

For me. I just switched to water cooling the CPU and silent case fans. CPU now idles around 15°C and never gets near dangerous heat even under 100% load for hours.
_________________
"You can lead a horticulture but you can't make her think" ~ Dorothy Parker
2021 is the year of the Linux Desktop!
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Wed Nov 28, 2018 2:48 pm    Post subject: Reply with quote

I'm sure the OP found their answer in the intervening 5 years before this thread was necro-bumped, but one option that wasn't mentioned in 2013 was cpulimit.

Would be better to just fix the defective fan though. Pull it apart, clean the spindle with rubbing alcohol and put a drop of oil on it. Worked for me.
Back to top
View user's profile Send private message
Irre
Guru
Guru


Joined: 09 Nov 2013
Posts: 434
Location: Stockholm

PostPosted: Wed Nov 28, 2018 7:50 pm    Post subject: Reply with quote

Ant P. wrote:
I'm sure the OP found their answer in the intervening 5 years before this thread was necro-bumped, but one option that wasn't mentioned in 2013 was cpulimit.

Would be better to just fix the defective fan though. Pull it apart, clean the spindle with rubbing alcohol and put a drop of oil on it. Worked for me.

I tested cpulimit some year ago:
Code:
time MAKEOPTS="-j 9 --load-average=9" emerge -j 9 -v1 --quiet-build=y dev-libs/lzo dev-python/six
 dev-util/meson dev-python/extras dev-python/pyrsistent dev-python/lxml app-text/build-docbook-catalog
 dev-lang/perl x11-libs/pango dev-python/testtools dev-python/fixtures

real    5m41.133s
user    17m46.989s
sys     7m34.383s

time MAKEOPTS="-j 1 --load-average=1" emerge -j 1 -v1 --quiet-build=y dev-libs/lzo dev-python/six
 dev-util/meson dev-python/extras dev-python/pyrsistent dev-python/lxml app-text/build-docbook-catalog
 dev-lang/perl x11-libs/pango dev-python/testtools dev-python/fixtures

real    17m18.606s
user    11m47.087s
sys     5m19.202s


timing after I entered these commands

cpulimit -e cc1plus  -l 4&
cpulimit -e cc1  -l 4&
cpulimit -e perl  -l 4&

real    101m58.763s
user    11m43.422s
sys     5m18.940s
Conclusions

MAKEOPTS="-j 1 --load-average=1" and emerge -j 1 ...

increase emerge time from 6 to 17 minutes

Adding cpulimit commands increase time from 17 to 102 minutes

in my test
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Thu Nov 29, 2018 1:19 pm    Post subject: Reply with quote

If you're using intel pstate, you can just tell him to restrict your cpu mhz rather than trying to limit how much work portage will force it to do.

Code:
> cat /proc/cpuinfo | grep "cpu MHz"
cpu MHz      : 4006.877
cpu MHz      : 4006.925
cpu MHz      : 4007.014
cpu MHz      : 4007.928
cpu MHz      : 4007.264
cpu MHz      : 4008.172
cpu MHz      : 4007.592
cpu MHz      : 4007.582
> echo 50 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
> cat /proc/cpuinfo | grep "cpu MHz"
cpu MHz      : 2204.212
cpu MHz      : 2203.858
cpu MHz      : 2203.505
cpu MHz      : 2203.949
cpu MHz      : 2204.173
cpu MHz      : 2204.555
cpu MHz      : 2205.173
cpu MHz      : 2204.197
> echo 100 > /sys/devices/system/cpu/intel_pstate/max_perf_pct
> cat /proc/cpuinfo | grep "cpu MHz"
cpu MHz      : 4007.132
...


in case you didn't already guess it, 100 = 100%, 50=50% ...
ps: that's just for the information, because the real stuff to do is fixing your fan issue
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