[opensuse] Process priority control
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I'm curious. I have a process doing some heavy calculations (par2) on an encrypted partition. The process is running with a nice value of 10, but kcryptd, which I suppose is a kernel module handling the encryption, is running at priority "-5", and sometimes it uses far more cpu - which means that the rest of my user processes are running with lower factual priority than the "background" par2 process. A similar situation occurs when I copy several gigabytes to an encrypted partition: even if the copy runs as "nice", the background kcryptd runs at higher priority than normal, slowing the entire machine. As kcryptd is not a child process of par2, it does not inherit its niceness value, I understand - but it is a real nuisance. Can this situation be changed? Another related question, is whether it would be possible to limit a process to having, say, 20% of the cpu. Ie, I don't care that it takes longer, but at that pace the cpu runs cooler, and the fan slower (and quieter). Anyhow, if I have to leave the computer on for other things, it doesn't matter how long it takes. This question has popped before here, but the answers were not conclusive, as far as I remember. Do we have something? A wild idea would be running the process as child of another, and the parent issuing sigstops/sigconts intermittently. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkm76SUACgkQtTMYHG2NR9WS+wCfcd3XZejW+cI7/oeczUNVQ233 4EwAn28opGi431ozJ8FXnTv8pR3auN+G =O4Eq -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos E. R. wrote:
I have a process doing some heavy calculations (par2) on an encrypted partition. The process is running with a nice value of 10, but kcryptd, which I suppose is a kernel module handling the encryption, is running at priority "-5", and sometimes it uses far more cpu - which means that the rest of my user processes are running with lower factual priority than the "background" par2 process. A similar situation occurs when I copy several gigabytes to an encrypted partition: even if the copy runs as "nice", the background kcryptd runs at higher priority than normal, slowing the entire machine.
As kcryptd is not a child process of par2, it does not inherit its niceness value, I understand - but it is a real nuisance.
Can this situation be changed?
Have you tried renicing kcryptd? I googled and saw one or two mailing list posting where people had reniced kcryptd to 0. -- Per Jessen, Zürich (10.8°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday, 2009-03-14 at 19:02 +0100, Per Jessen wrote:
As kcryptd is not a child process of par2, it does not inherit its niceness value, I understand - but it is a real nuisance.
Can this situation be changed?
Have you tried renicing kcryptd? I googled and saw one or two mailing list posting where people had reniced kcryptd to 0.
No, I haven't... It is a hack, and can't be easily automated. And meddling with a kernel process sounds a bit scary: if it has a negative niceness must be for some reason I don't know about :-? Anyway, I just tried, I used "top" to find out which of the several kcrypt processes was using most cpu and reniced it. First to 0, then to 5, to see if it showed in the graph in green - it doesn't, it shows as a system process, obviously. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkm8DGQACgkQtTMYHG2NR9UPzQCeMdYw0IyGNfsyWYFJHZqH5xkS ZScAoJWgyJOD2h74CHkl4RIsWaIAKjII =r9tf -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Carlos E. R. wrote:
Anyway, I just tried, I used "top" to find out which of the several kcrypt processes was using most cpu and reniced it. First to 0, then to 5, to see if it showed in the graph in green - it doesn't, it shows as a system process, obviously.
The question is - did it make your system behave better? /Per -- Per Jessen, Zürich (7.3°C) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday, 2009-03-15 at 09:05 +0100, Per Jessen wrote:
Carlos E. R. wrote:
Anyway, I just tried, I used "top" to find out which of the several kcrypt processes was using most cpu and reniced it. First to 0, then to 5, to see if it showed in the graph in green - it doesn't, it shows as a system process, obviously.
The question is - did it make your system behave better?
Dunno... I was not doing a task at the moment that needed cpu, so I couldn't notice. I have to try more. Is not so simple, though, because these encrypted partitions of mine are used for backup (to DVD image) and mounted/umounted frequently, and thus the kcrypt process changes, ie, a new one is created. And it is not possible (I think) to know to which partition each process belongs. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEUEARECAAYFAkm9CKIACgkQtTMYHG2NR9XeyQCWOiIGw/vIobvEeeUUfgDrHQX5 ngCfZ38b+d90QVUvdT1aitbdEj7WDyI= =BEf9 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Am Samstag, 14. März 2009 schrieb Carlos E. R.:
[...]. Ie, I don't care that it takes longer, but at that pace the cpu runs cooler, and the fan slower (and quieter).
Did you try to reduce the cpu frequency? E.g., by switching to the powersave governer via cpufrequtils or powerdevil (kpowersave in case of KDE3)?
Anyhow, if I have to leave the computer on for other things, it doesn't matter how long it takes. [...].
JFYI, such a strategy increases power consumption, AFAIK. Gruß Jan -- Remember the turtle, he never makes any progress until he sticks his neck out. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Content-ID:
Am Samstag, 14. März 2009 schrieb Carlos E. R.:
[...]. Ie, I don't care that it takes longer, but at that pace the cpu runs cooler, and the fan slower (and quieter).
Did you try to reduce the cpu frequency? E.g., by switching to the powersave governer via cpufrequtils or powerdevil (kpowersave in case of KDE3)?
My cpu doesn't support frequency control.
Anyhow, if I have to leave the computer on for other things, it doesn't matter how long it takes. [...].
JFYI, such a strategy increases power consumption, AFAIK.
No, I don't think so. If you need to leave the computer running 24/7 for some other reason, like it is a server of some kind, then it can be also running a heavy task; in this case, it makes sense to make this task run with, say max 50% cpu, in order not to heat the cpu more than needed. If the computer doesn't need to be up, then it makes sense to finish as fast as possible. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkm9X2MACgkQtTMYHG2NR9XYdwCdFAKCIiLd/OS56igYuRiFeEE6 q24An2eBOse4K93lqTO4YDnexFNRgRE+ =B7R4 -----END PGP SIGNATURE-----
Am Sonntag, 15. März 2009 schrieb Carlos E. R.:
Content-ID:
On Sunday, 2009-03-15 at 15:52 +0100, Jan Ritzerfeld wrote:
Am Samstag, 14. März 2009 schrieb Carlos E. R.: [...].
Anyhow, if I have to leave the computer on for other things, it doesn't matter how long it takes. [...].
JFYI, such a strategy increases power consumption, AFAIK.
No, I don't think so.
Well, this is true for my idea of putting your CPU into powersave mode, at least on Intel hardware and according to Arjan van de Ven: | it's better to execute the code you need to execute at full speed, and | then really quickly go idle, than it is to execute at a much lower speed. http://www.bughost.org/pipermail/power/2007-May/000166.html | it's more energy efficient to go to max fast and get the work done (and | then go to idle), than it is to go to medium speeds and be less idle http://www.bughost.org/pipermail/power/2007-May/000071.html
If you need to leave the computer running 24/7 for some other reason, like it is a server of some kind, then it can be also running a heavy task; in this case, it makes sense to make this task run with, say max 50% cpu, in order not to heat the cpu more than needed.
This will limit the noise level, and that is what you want. :)
If the computer doesn't need to be up, then it makes sense to finish as fast as possible.
The same holds true for CPUs that support frequency scaling, because in idle mode they consume much less power than than in lower speed mode. Search the web for race-to-idle. Gruß Jan -- Some men are alive simply because it is against the law to kill them. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Am Samstag, 14. März 2009 schrieb Carlos E. R.:
[...]. Another related question, is whether it would be possible to limit a process to having, say, 20% of the cpu. [...].
http://cpulimit.sourceforge.net/ http://download.opensuse.org/repositories/home:/etrash/
A wild idea would be running the process as child of another, and the parent issuing sigstops/sigconts intermittently.
| Now cpulimit does limit also the children of the specified process. The | code is still experimental, so let me know how it is. Gruß Jan -- No snowflake in an avalanche ever feels responsible. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday, 2009-03-15 at 16:03 +0100, Jan Ritzerfeld wrote:
Am Samstag, 14. März 2009 schrieb Carlos E. R.:
[...]. Another related question, is whether it would be possible to limit a process to having, say, 20% of the cpu. [...].
http://cpulimit.sourceforge.net/ http://download.opensuse.org/repositories/home:/etrash/
This looks just like it.
A wild idea would be running the process as child of another, and the parent issuing sigstops/sigconts intermittently.
| Now cpulimit does limit also the children of the specified process. The | code is still experimental, so let me know how it is.
It seems my idea is not so wild, after all. Still, doing this in userspace I suppose is not so efficient as if the kernel could do it directly in the scheduler. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkm9YDkACgkQtTMYHG2NR9XXYQCggxwhsHFuSf+/ZhvFx92uYgMH WscAnRNeY0b5v/VSsDvOcMsHdg2lpJWj =gyh1 -----END PGP SIGNATURE-----
Am Sonntag, 15. März 2009 schrieb Carlos E. R.:
On Sunday, 2009-03-15 at 16:03 +0100, Jan Ritzerfeld wrote:
Am Samstag, 14. März 2009 schrieb Carlos E. R.:
[...]. Another related question, is whether it would be possible to limit a process to having, say, 20% of the cpu. [...].
http://cpulimit.sourceforge.net/ http://download.opensuse.org/repositories/home:/etrash/
This looks just like it.
At least, it seems worth trying.
A wild idea would be running the process as child of another, and the parent issuing sigstops/sigconts intermittently.
| Now cpulimit does limit also the children of the specified process. | The code is still experimental, so let me know how it is.
It seems my idea is not so wild, after all.
Right! :-D
Still, doing this in userspace I suppose is not so efficient as if the kernel could do it directly in the scheduler.
I do not know. http://linux-vserver.org/CPU_Scheduler#Token_Bucket_Extension http://en.wikipedia.org/wiki/OpenVZ#CPU_scheduler For keeping the average(!) CPU temperatue low, this should be sufficient. Gruß Jan -- If you can't measure it, I'm not interested. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Monday, 2009-03-16 at 07:43 +0100, Jan Ritzerfeld wrote:
Am Sonntag, 15. März 2009 schrieb Carlos E. R.:
On Sunday, 2009-03-15 at 16:03 +0100, Jan Ritzerfeld wrote:
Am Samstag, 14. März 2009 schrieb Carlos E. R.:
[...]. Another related question, is whether it would be possible to limit a process to having, say, 20% of the cpu. [...].
http://cpulimit.sourceforge.net/ http://download.opensuse.org/repositories/home:/etrash/
This looks just like it.
At least, it seems worth trying.
It does work; in some cases better, some others not so good. But fair enough. You need to start it on a terminal, like: cpulimit -e par2 -l 50 when the par2 process ends, it waits for another of the same name, and then controls it. It complains a bit if it does not run as root: ] Warning: cannot renice. I don't know how important is that. It has some funny effects: I used it by PID on a "cp" started inside "mc", and mc thought the process had backgrounded and returned the terminal. You know what would be cute? Having an interface like "top", where you could select one or several processes to limit, in just one control terminal. Going up/down with the cursor, then the +/- keys to change the limits, then seeing the resulting behavior on the same display :-)~~
A wild idea would be running the process as child of another, and the parent issuing sigstops/sigconts intermittently.
| Now cpulimit does limit also the children of the specified process. | The code is still experimental, so let me know how it is.
It seems my idea is not so wild, after all.
Right! :-D
Still, doing this in userspace I suppose is not so efficient as if the kernel could do it directly in the scheduler.
I do not know.
http://linux-vserver.org/CPU_Scheduler#Token_Bucket_Extension
Interesting... but I understand it is not something the default linux kernel does. I'll have to read more of it, another day.
Curious.
For keeping the average(!) CPU temperatue low, this should be sufficient.
I don't think any of those to can be applied to a typical or default install, it is for virtual servers :-? - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAknJbggACgkQtTMYHG2NR9XHxwCfc8vTqIfUoL3AWQPH291m34m9 ClcAoIoMOe5DWiOG/SeBvv2AY6XHv8Et =ahDk -----END PGP SIGNATURE-----
participants (4)
-
Carlos E. R.
-
Carlos E. R.
-
Jan Ritzerfeld
-
Per Jessen