Re: RFC: documentation of the autogroup feature

From: Michael Kerrisk (man-pages)
Date: Tue Nov 29 2016 - 04:11:02 EST


[Resending because of bounces from the lists. (Somehow my mailer
messed up the MIME labeling)]

Hi Mike,

On 11/28/2016 02:46 AM, Mike Galbraith wrote:
> On Sun, 2016-11-27 at 22:13 +0100, Michael Kerrisk (man-pages) wrote:
>
>> Here's my attempt to define the root task group:
>>
>> * If autogrouping is disabled, then all processes in the root CPU
>> cgroup form a scheduling group (sometimes called the "root task
>> group").
>>
>> Can you improve on this?

The below is helpful, but...

> A task group is a set of percpu runqueues.

The explanation needs really to be in terms of what user-space
understands and sees. "Runqueues" are a kernel scheduler implementation
detail.

> The root task group is the
> top level set in a hierarchy of such sets when group scheduling is
> enabled, or the only set when group scheduling is not enabled. The
> autogroup hierarchy has a depth of one, ie all autogroups are peers
> who's common parent is the root task group.

Let's try and go further. How's this:

When scheduling non-real-time processes (i.e., those scheduled
under the SCHED_OTHER, SCHED_BATCH, and SCHED_IDLE policies), the
CFS scheduler employs a technique known as "group scheduling", if
the kernel was configured with the CONFIG_FAIR_GROUP_SCHED option
(which is typical).

Under group scheduling, threads are scheduled in "task groups".
Task groups have a hierarchical relationship, rooted under the
initial task group on the system, known as the "root task group".
Task groups are formed in the following circumstances:

* All of the threads in a CPU cgroup form a task group. The parâ
ent of this task group is the task group of the corresponding
parent cgroup.

* If autogrouping is enabled, then all of the threads that are
(implicitly) placed in an autogroup (i.e., the same session, as
created by setsid(2)) form a task group. Each new autogroup is
thus a separate task group. The root task group is the parent
of all such autogroups.

* If autogrouping is enabled, then the root task group consists
of all processes in the root CPU cgroup that were not otherwise
implicitly placed into a new autogroup.

* If autogrouping is disabled, then the root task group consists
of all processes in the root CPU cgroup.

* If group scheduling was disabled (i.e., the kernel was configâ
ured without CONFIG_FAIR_GROUP_SCHED), then all of the proâ
cesses on the system are notionally placed in a single task
group.

[To be followed by a discussion of the nice value and task groups]

?

Cheers,

Michael


--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/