]> asedeno.scripts.mit.edu Git - linux.git/commit
cgroup: introduce cgroup->dom_cgrp and threaded css_set handling
authorTejun Heo <tj@kernel.org>
Mon, 15 May 2017 13:34:02 +0000 (09:34 -0400)
committerTejun Heo <tj@kernel.org>
Fri, 21 Jul 2017 15:14:51 +0000 (11:14 -0400)
commit454000adaa2a7420df6e56a42f22726d05872a3f
treef4cd89577cc86f65822adf1fb238ad32c0f9007f
parentbc2fb7ed089ffd16d26e1d95b898a37d2b37d201
cgroup: introduce cgroup->dom_cgrp and threaded css_set handling

cgroup v2 is in the process of growing thread granularity support.  A
threaded subtree is composed of a thread root and threaded cgroups
which are proper members of the subtree.

The root cgroup of the subtree serves as the domain cgroup to which
the processes (as opposed to threads / tasks) of the subtree
conceptually belong and domain-level resource consumptions not tied to
any specific task are charged.  Inside the subtree, threads won't be
subject to process granularity or no-internal-task constraint and can
be distributed arbitrarily across the subtree.

This patch introduces cgroup->dom_cgrp along with threaded css_set
handling.

* cgroup->dom_cgrp points to self for normal and thread roots.  For
  proper thread subtree members, points to the dom_cgrp (the thread
  root).

* css_set->dom_cset points to self if for normal and thread roots.  If
  threaded, points to the css_set which belongs to the cgrp->dom_cgrp.
  The dom_cgrp serves as the resource domain and keeps the matching
  csses available.  The dom_cset holds those csses and makes them
  easily accessible.

* All threaded csets are linked on their dom_csets to enable iteration
  of all threaded tasks.

* cgroup->nr_threaded_children keeps track of the number of threaded
  children.

This patch adds the above but doesn't actually use them yet.  The
following patches will build on top.

v4: ->nr_threaded_children added.

v3: ->proc_cgrp/cset renamed to ->dom_cgrp/cset.  Updated for the new
    enable-threaded-per-cgroup behavior.

v2: Added cgroup_is_threaded() helper.

Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/cgroup-defs.h
include/linux/cgroup.h
kernel/cgroup/cgroup.c