Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756297AbcK2JLA (ORCPT ); Tue, 29 Nov 2016 04:11:00 -0500 Received: from mail-wj0-f193.google.com ([209.85.210.193]:32903 "EHLO mail-wj0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754410AbcK2JKo (ORCPT ); Tue, 29 Nov 2016 04:10:44 -0500 MIME-Version: 1.0 Reply-To: mtk.manpages@gmail.com In-Reply-To: <1127218a-dd9b-71a8-845d-3a83969632fc@gmail.com> References: <41d802dc-873a-ff02-17ff-93ce50f3e925@gmail.com> <1479901185.4306.38.camel@gmx.de> <327586fa-4672-d070-0ded-850654586273@gmail.com> <1479915229.4306.106.camel@gmx.de> <8614679c-b1d3-3b35-193d-2ab6eac45aff@gmail.com> <1480297574.9163.76.camel@gmx.de> <1127218a-dd9b-71a8-845d-3a83969632fc@gmail.com> From: "Michael Kerrisk (man-pages)" Date: Tue, 29 Nov 2016 10:10:22 +0100 Message-ID: Subject: Re: RFC: documentation of the autogroup feature To: Mike Galbraith Cc: Michael Kerrisk , Peter Zijlstra , Ingo Molnar , linux-man , lkml , Thomas Gleixner Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uAT9B73f032111 Content-Length: 2966 Lines: 78 [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/