* [gentoo-user] Per-process CPU % usage limit
@ 2006-07-08 15:40 Etaoin Shrdlu
2006-07-08 21:13 ` Richard Fish
2006-07-11 23:32 ` Evan Klitzke
0 siblings, 2 replies; 5+ messages in thread
From: Etaoin Shrdlu @ 2006-07-08 15:40 UTC (permalink / raw
To: gentoo-user
As the subject says, is there any way to force a particular process to
use at most a given CPU percentage?
Ulimit does not help, since I don't want a CPU time limit and I don't
want the process to be killed.
The problem is that some very CPU-consuming apps, even if started with
the lowest priority (eg, nice -n 19), still eat up 100% CPU (with
subsequent overheating, fan start, throttling, etc.) if the system is
not busy and has nothing else to do. What I'd like to know is whether it
is possible to impose such a CPU percentage usage limit.
Thanks for any help.
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Per-process CPU % usage limit
2006-07-08 15:40 [gentoo-user] Per-process CPU % usage limit Etaoin Shrdlu
@ 2006-07-08 21:13 ` Richard Fish
2006-07-09 15:35 ` Etaoin Shrdlu
2006-07-11 23:32 ` Evan Klitzke
1 sibling, 1 reply; 5+ messages in thread
From: Richard Fish @ 2006-07-08 21:13 UTC (permalink / raw
To: gentoo-user
On 7/8/06, Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote:
> The problem is that some very CPU-consuming apps, even if started with
> the lowest priority (eg, nice -n 19), still eat up 100% CPU (with
> subsequent overheating, fan start, throttling, etc.) if the system is
> not busy and has nothing else to do. What I'd like to know is whether it
> is possible to impose such a CPU percentage usage limit.
Well, I would first upgrade my cooling fans so the processor couldn't
overheat! :-)
But you could also enable "CPU freqency scaling" in the kernel, with
the ondemand governor, and use the various settings in
/sys/devices/system/cpu/cpu0/cpufreq to control the clock speed and
behavior of the system. You can use scaling_max_freq to specify the
maximum frequency of the processor so that it will not overheat or
throttle, no matter what the load is, and the
ondemand/ignore_nice_load setting will tell the governor not to
increase the clock speed for niced processes.
-Richard
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Per-process CPU % usage limit
2006-07-08 21:13 ` Richard Fish
@ 2006-07-09 15:35 ` Etaoin Shrdlu
0 siblings, 0 replies; 5+ messages in thread
From: Etaoin Shrdlu @ 2006-07-09 15:35 UTC (permalink / raw
To: gentoo-user
First, thanks for your answer!
On Saturday 8 July 2006 23:13, Richard Fish wrote:
> Well, I would first upgrade my cooling fans so the processor couldn't
> overheat! :-)
Upgrading cooling fan in a laptop isn't the easiest thing to do! :)
> But you could also enable "CPU freqency scaling" in the kernel, with
> the ondemand governor, and use the various settings in
> /sys/devices/system/cpu/cpu0/cpufreq to control the clock speed and
> behavior of the system. You can use scaling_max_freq to specify the
> maximum frequency of the processor so that it will not overheat or
> throttle, no matter what the load is, and the
> ondemand/ignore_nice_load setting will tell the governor not to
> increase the clock speed for niced processes.
This is better, but still affects the system as a whole, and higly
depends on the capabilities of your CPU.
What I really was looking for is something that can be configured
per-process, to be able to limit only the CPU eaters.
Though not exactly what I was looking for, the ondemand/ignore_nice_load
approach is probably the closest to what I want, although it still
requires to be running at reduced CPU frequency. While certainly
avoiding overheating, IIUC the governors.txt file all the system runs at
reduced speed, but the CPU-intensive tasks (if suitably reniced) do not
make the CPU increase its frequency. And we're still talking about CPU
speed, not % usage.
I guess that truly limiting per-process CPU usage to a maximum percentage
would require some modification to the kernel scheduuling code, After
another bit of googling, I found this
http://www.tls-technologies.com/CPU/cpu-main.html
but unfortunately that is only for the 2.4 kernel.
Thanks for the answer,
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Per-process CPU % usage limit
2006-07-08 15:40 [gentoo-user] Per-process CPU % usage limit Etaoin Shrdlu
2006-07-08 21:13 ` Richard Fish
@ 2006-07-11 23:32 ` Evan Klitzke
2006-07-12 10:16 ` Etaoin Shrdlu
1 sibling, 1 reply; 5+ messages in thread
From: Evan Klitzke @ 2006-07-11 23:32 UTC (permalink / raw
To: gentoo-user
On 7/8/06, Etaoin Shrdlu <shrdlu@unlimitedmail.org> wrote:
> As the subject says, is there any way to force a particular process to
> use at most a given CPU percentage?
Although I haven't used it myself, I am fairly confident that this is
what the cpu option does in /etc/security/limits.conf. You will need
to have PAM enabled.
-- Evan Klitzke
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-user] Per-process CPU % usage limit
2006-07-11 23:32 ` Evan Klitzke
@ 2006-07-12 10:16 ` Etaoin Shrdlu
0 siblings, 0 replies; 5+ messages in thread
From: Etaoin Shrdlu @ 2006-07-12 10:16 UTC (permalink / raw
To: gentoo-user
On Wednesday 12 July 2006 01:32, Evan Klitzke wrote:
> Although I haven't used it myself, I am fairly confident that this is
> what the cpu option does in /etc/security/limits.conf. You will need
> to have PAM enabled.
The comments in the file talk about "CPU time (MIN)", so I guess this
does the same as ulimit -t, and furthermore affects all of a given
user's processes (not just a chosen process).
Anyway, I'll take a look.
Thanks for the info.
--
gentoo-user@gentoo.org mailing list
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-07-12 9:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-08 15:40 [gentoo-user] Per-process CPU % usage limit Etaoin Shrdlu
2006-07-08 21:13 ` Richard Fish
2006-07-09 15:35 ` Etaoin Shrdlu
2006-07-11 23:32 ` Evan Klitzke
2006-07-12 10:16 ` Etaoin Shrdlu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox