Skip to content

Nice all threads of multithreaded programs

Jiří Paleček requested to merge jpalecek/ksysguard:nice-all-threads into master

Setting process priorities by ksysguard has the flaw that it only sets priority of a single thread of a multithreaded program. For example, if I want to put handbrake encoding to the background, it usually fails as other threads from the same process continue to hog the CPU. This patch changes the behavior by attempting to change the priority of all threads (on Linux).

There is a caveat: when the threads' priorities were previously different, it may mean you change the priority against the logic of the application. For example some background threads of an application might end up having the same priority as the foreground. As a corollary, the call may mean lowering priority of some threads, but raising it for others and thus fail due to insufficient capabilities. Still, I think this behavior is actually the only one usable, until we have individual threads in ksysguard. Even then, I doubt people will look at the individual threads when renicing. Till then, the ability to renice a task is a need which ksysguard should fulfill, but unfortunately doesn't.

Note: this only changes the behavior for remote computers. Local use needs a similar fix in libksysguard.

This is an old phabricator diff https://phabricator.kde.org/D29615, which has been accepted but not applied

Merge request reports