Bug 33962 - Automatic process group scheduling breaks "niceness" behaviour
Summary: Automatic process group scheduling breaks "niceness" behaviour
Status: RESOLVED WILL_NOT_FIX
Alias: None
Product: Process Management
Classification: Unclassified
Component: Scheduler (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: Ingo Molnar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 10:07 UTC by Robert Cernansky
Modified: 2012-08-20 15:55 UTC (History)
2 users (show)

See Also:
Kernel Version: 2.6.38
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Robert Cernansky 2011-04-26 10:07:51 UTC
If SCHED_AUTOGROUP is set, the nice value is not respected across cgroups.

Simple scenario:

A) Without SCHED_AUTOGROUP:

1. Open two terminals
2. In first terminal run: 'yes > /dev/null'
3. In second terminal run: 'nice -n 19 yes > /dev/null'

Observe with 'top' that 'yes' with nice 19 gets significantly less portion of CPU time than the other one.  Which is good and expected.


B) With SCHED_AUTOGROUP turned on:

1. Open two terminals
2. In first terminal run: 'yes > /dev/null'
3. In second terminal run: 'nice -n 19 yes > /dev/null'

Observe with 'top' that 'yes' with nice 19 gets *equal* portion of CPU time as the other one with nice 0.  IMO, not so good and expected.


Expected behaviour is that in B) the CPU time between the two 'yes' processes is distributed exactly as in A).

Of course, this is a very simple scenario; with one process within each cgroup.  What the behaviour would be with more processes, each with *different* nice value, in a same cgroup, may not be so trivial to decide and it may be a topic for discussion.  But whatever will be decided, the basic scenario described here should always work as if SCHED_AUTOGROUP was turned off.

One possible general behaviour could be that each cgroup will have an internal (or virtual) nice value itself, computed as an average of nice values of all processes within a cgroup.
Comment 1 Peter Zijlstra 2011-04-26 21:42:26 UTC
That is exactly the expected behaviour of groups. Time is fairly distributed between groups (equally if each group has the same weight), after that it is fairly distributed between the tasks of that group (equally if ...).

The auto-group stuff creates a group per tty, which with the above corresponds to a group per terminal.
Comment 2 Robert Cernansky 2011-04-27 06:56:11 UTC
> That is exactly the expected behaviour of groups. Time is fairly distributed
> between groups...

That is OK.  But I'd expect that "nice" will be taken into account also for a grup as such.  Take this bug as a "wish for a feature" which you may consider to implement.  If not, that's fine, I will not use cgroups and stick with plain nice.

Note You need to log in before you can comment on or make changes to this bug.