Page 1 of 1

Linux and Process Scheduler Autogroups

Posted: Thu Sep 26, 2019 4:55 pm
by nburgin
Right now the Linux client attempts to de-prioritize itself by setting its nice level to 19.

However, this does not work if scheduler autogroups are enabled. What's more, I've asked around and it seems like at least 3 of the supported distributions (Ubuntu, Mint, and Fedora) enable this feature by default.

As described in the scheduler manual page, when it's turned on the standard nice levels are only effective relative to other processes in the group, not system-wide. When the client is run as a background service, it receives its own group, so setting everything to nice level 19 actually doesn't do anything.

While a CPU hungry background task that hasn't raised its nice level will have significantly less impact on foreground processes if autogroups are enabled (only being noticeable under very heavy foreground workloads), this is still more impact than a nice 19 process would normally have without autogroups, and increasing the nice level no longer has any effect. You can demonstrate the lack of efficacy of the nice level by renice'ing F@H to -20 (very high priority) on an affected system, and noting that the level of impact on foreground processes/overall responsiveness has not actually increased.

As described in the manual page, there is a workaround that can be achieved by setting the autogroup's own nice level, which apparently is not available through standard system calls but only through a virtual file located at /proc/self/autogroup or /proc/<PID-goes-here>/autogroup.

While I currently have a workaround in place on my own system, It would be nice if future releases of the client could be autogroup-aware when setting its priority, since the enabling of autogroups is default setting on at least 3 of the supported distributions.

If autogroup-aware priority setting won't be directly supported, then it would at least be nice to add some documentation to make sure Ubuntu, Mint and Fedora users are aware of the issue so they can take steps to resolve it themselves if it's affecting their foreground tasks.

This reddit thread may be relevant.

EDIT: Added the links I meant to earlier, now that I'm no longer a new user under heavy suspicion from the spam filter.

Re: Linux and Process Scheduler Autogroups

Posted: Sat Mar 14, 2020 1:22 pm
by upsuper
I notice exactly the same thing.

Comparing to updating the autogroup priority, an alternative approach may be to use a different schedule policy, specifically SCHED_IDLE, so that it only uses idle resources after all other processes. I think this is probably the recommended approach in general.